12 class practicle file multimedia & web technology

Embed Size (px)

Citation preview

  • 7/29/2019 12 class practicle file multimedia & web technology

    1/68

    Created by saurabh singh naruka lecturer marudhar defence girls college merta

    city nagaur

    HTML dk ifjp; %& Html : html ,d scripting language gSA html dk iqjk uke hyper

    text markup language gSA html dk mi;ksx web page vFkok website cukus ds fy,

    fd;k tkrk gSA

    osc istks dks leqg osc lkbV dgykrh gSA

    HTML Vsx ds izdkj %&

    ,p Vh ,e ,y es Vsx gksrs gS vkSj izR;sd Vsx dk viuk ,fVC;wV vkSj eku gksrk gSA

    Vsx czkmtj dks lwpuk nsrs gS fd mudks osc ist ij vko;drkuqlkj fn[kk;k tk;sA

    Vsx nks izdkj ds gksrs gS %&

    1 d.Vsuj Vsxl~ container Tags

    2 ,EIVh Vsxl~ Empty Tags

    1 container Tags %& d.Vsuj Vsx VsDLV ds [k.M section ij yxrs gS d.Vsuj

    Vsx dks ,d vkWifuax Vsx ,d Dyksftax Vsx dh vkoldrk gksrh gS tks [k.M ds

    nksuksa rjQ yxrs gSaA ysfdu Dyksftax Vsx esa lcls igys Lysk / yxkrs gSA

    mnkgj.k %&

    vkSj

    vkSj

    2 Empty Tags %& ,EIVh Vsx vdsys Vsx gksrs gS tks VsDLV ij izHkko ugha

    Mkyrs gSA ,EIVh Vsx esa vkWifuax Vsx gksrk gS ysfdu Dyksfxat Vsx dh vko;drk

    ugh gksrh gSA

    mnkgj.k %&

    ---------------------------------------------------------------------------------------------------------------

    ---------------------------------------

    ,fVz~C;wVl~ (Attributes) %& Vsx dk O;ogkj ,fVC;wV dk mi;ksx dj cnyk tk ldrk

    gSA ,d Vsx ds dbZ ,fVC;wV gks ldrs gSA ,fVC;wV ds eku dk Mcy dksVsku esa can

    djuk pkfg,A

    Html ds ewy Vsx %&

    (i) HTML TAG :- ;g ,d dUVsuj Vsx gS vkSj nLrkost ds var esa Dyksftax Vsx dh

    vko;drk gksrh gSA ;g Vsx

    czkmtj dks crkrk gS fd ;g Qkby ,p Vh ,e ,y dh gSA

    mnkgj.k %& vkSj

    (ii) HEAD TAG :- khkZ [k.M nLrkost ds ckjs es lwpuk j[krk gSA khkZ Vsx Hkh ,d

    dUVsuj Vsx gS VkbVy Vsx blds ckn vkrk gSA

    mnkgj.k %& vkSj

  • 7/29/2019 12 class practicle file multimedia & web technology

    2/68

    (iii) TITLE TAG :- ;g Vsx czkmtj ds VkbVy ckj esa VkbVy dks izdV djus dh vuqefr

    nsrk gS ;g flQkfjk

    djrk gS fd VkbVy esa lk/kkj.k VsDLV gksuk pkfg, dksbZ best ;k fyad ughA

    mnkgj.k %& vkSj

    (iv) BODY Section :- ;g Vsx nLrkost dk gn; gksrk gS ckWMh og gS tgkW okLrfod

    oscist ij iznfkZr gksus ds fy, curk gSA ckWMh Vsx ] gsM Vsx ds fcYdqy ckn esavkrk gS czkmtj lHkh fok;ksa dks fn[kkrk gS tks fd ckWMh Vsx ds vksifuax vkSjDyksftax ds e/; vkrs gSaA mnkgj.k %& vkSj

    HTML

    Q1. vkMZj fyLV ds }kjk buiqV fMokbt fn[kkus ds fy, ,d html code fyf[k,A

    Html Code:

    board of secondary education

    list of input devices :

    key board

    mouse

  • 7/29/2019 12 class practicle file multimedia & web technology

    3/68

    list of input devices :

    key board

    mouse

    optical character reader

    scanner

    Output:

    -----------------------------------------------------------------------------------------

    Q2. Html es ,d osc ist cukb;s ftlesa fiDpj fn[kk;s rFkk Ldwy dk uke

    iznfkr gksA

    Html Code:

    MDS

    marudhar defence sr. sec. school

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    4/68

    Q3. vU; html ist ds fy, hyper linkcukus gsrq html dksM fyf[k,A

    Html Code:

    marudhar

    about gandhi

    gandhi.html

    marudhar

    father of the nation

    Output:

    (1)Asp D;k gSA \

    Asp ,d ekbdzkslkQV VsDusyksth gS tks baVjusV vkSj osc ist ds chp bUVj,sDku

    djkrh gSA ;g dsoy html dk ,DVsuu gS tks fd ljoj lkbM ij ju gksrh gS bles client

    browser dk mi;ksx ugh gksrk gS blesa lkjk dke ljoj ij gksrk gSA

    -------------------------------------------------------------------------------------------------------------------------------------------

    (2) IIS dks Install djus ds pj.k fyf[k,A

    (1) Start Button --> Setting option --> control panel --> add/remove programs icon dk pquko djA

  • 7/29/2019 12 class practicle file multimedia & web technology

    5/68

    (2) sa add/remove windows components es ls add/remove window dk p;u djsaA

    (3) ;g window components dh fyLV nkkZ;sxh blesa ls IIS ds check box dks pquuk

    iMsxkA blds ckn

    okij clickdjsaA

    (4) blds ckn inetpub uke dk QksYMj ;k esa cu tk;sxkA

    (5) blds vUnj ,d Sub directory gksrh gS ftldk uke wwwroot gksrk gSA

    (6) blds ckn ge wwwroot directory esa vius uke dkfolder cuk;asxs vksj asp esa cuh

    gqbZ Qkby dks vius

    uke ds QksYMj esa lqjf{kr djsxsaA

    (7) Ckuh gqbZ asp file Qkby dks ju djus ds fy, ge ckmtj fo.Mks Eksa fuEufyf[kr

    URL dk mi;ksx djrs gSA

    URL = http://localhost/foldername/filename.asp

    ,UVj djus ij Qkby esa cus gq, dksM dk vkmViqV gesa ckmtj ij iznfkZr gks

    tkrk gSA

    -----------------------------------------------------------------------------------------------

    -----------------------------------------------------------------------------------------------

    ----------------------------------

    Vbscript

    Ex 4: Hello dks osc ist ij iznfkr djus gsrq ,d izksxzke fyf[k,A

    -Show User Name-

    sub newpages(txt)

  • 7/29/2019 12 class practicle file multimedia & web technology

    6/68

    document.writeln("Hello " + txt)

    end sub

    Enter User Name

    This is Working ON Internet Explorer

    Output:

    Ex 5: ,d osc ist cukb, tks eSlst ckDl ds lkFk fuEu lansk iznfkr djs : welcome to myweb site

    -Display Message Box-

    sub msgs()

    msgbox("Welcome To My Web Site")

  • 7/29/2019 12 class practicle file multimedia & web technology

    7/68

    end sub

    This is Working ON Internet Explorer

    Output:

    --------------------------------------------------------------------------------------------------------------------

    Ex 6: ,d Vbscript dksM fyf[k, tks Length, Breadth rFkkHeight dks ysrs gq, Areaof rectangle

    dks iznfkr djsA

    -Area Of Rectangle-

    sub area()

    dim l,b,h,ar

    l=form1.l.value

    b=form1.b.value

  • 7/29/2019 12 class practicle file multimedia & web technology

    8/68

    h=form1.h.value

    ar=l*b*h

    msgbox("Area " & ar)

    end sub

    Length

    Breadth

    Height


    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    9/68

    Ex 7: Create a program to generate a hit counter.

    -Hit Counter-

    sub msgs()

    msgbox("Welcome To My Web Site")

    end sub

    dim counter

    counter=0

    sub count()

    counter=counter+1

    msgbox("Counter : " & counter)

    end sub

  • 7/29/2019 12 class practicle file multimedia & web technology

    10/68

    Output:

    ---------------------------------------------------------------------------------------------------

    Ex 8: vbscript dk mi;ksx djrs gq, calculatordk fuekZ.k fdft,A

  • 7/29/2019 12 class practicle file multimedia & web technology

    11/68

    Code:

    -Calculator-

    sub calc(ch)

    if(ch="=")then

    form1.t.value= eval(form1.t.value)

    else

    if(ch="C") then

    form1.t.value= ""

    else

    form1.t.value=form1.t.value & ch

    end if

    end if

    end sub



  • 7/29/2019 12 class practicle file multimedia & web technology

    12/68




    Output:

    Ex 9: ,d izksxzke fyf[k, tks null or empty string gksus ij lansk iznfkr djsA

    Code:

    -Check Null Or Empty String-

  • 7/29/2019 12 class practicle file multimedia & web technology

    13/68

    sub check()

    if(form1.t.value="")then

    msgbox("Enter The Text")

    form1.t.focus()

    else

    alert("Thank You")

    end if

    end sub

    Enter a Text

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    14/68

    ----------------------------------------------------------------------------------------------------------------

    Ex 10: ,d Qkse dk fuekZ.k fdft, ftles Email field gksA RkFkk bls osfyMsV djus ds fy, ,dvbscript dksM fyf[k,A

    Code:

    -E Mail Validation-

    sub check()

    if(form1.t.value="")then

    alert("Enter The Text")

    form1.t.focus()

    else

    dim email,a,d,diff,k,c

  • 7/29/2019 12 class practicle file multimedia & web technology

    15/68

    email=form1.t.value

    a=InStr(1,email,"@")

    d=InStr(1,email,".")

    diff=d-a

    k=d+1

    c=Mid(email, k, 1)

    if(a

  • 7/29/2019 12 class practicle file multimedia & web technology

    16/68

    -----------------------------------------------------------------------------------------------------

    Ex 11: fuEufyf[kr fQYM dk mi;ksx djrs fg, ,d Qkse dk fuekZ.k fdft, rFkk bUgs

    osfyMsV djus ds fy, vbscript dksM fyf[k,A

    Name - textbox

    Address - textbox

    Date Of Birth - Combo box

    Email - textbox

    Code:

    -Area Of Rectangle-

    sub check()

    if(form1.n.value="")then

    alert("Enter The Name")

    form1.n.focus()

    elseif(form1.a.value="")then

    alert("Enter The Address")

    form1.a.focus()

  • 7/29/2019 12 class practicle file multimedia & web technology

    17/68

    elseif(form1.y.value="")then

    alert("Enter The Year")

    form1.y.focus()

    elseif(form1.d.value="")then

    alert("Select The Day")

    form1.d.focus()

    elseif(form1.m.value="")then

    alert("Select The Month")

    form1.m.focus()

    elseif(form1.mail.value="")then

    dim email,a,d,diff,k,c

    email=form1.t.value

    a=InStr(1,email,"@")

    d=InStr(1,email,".")

    diff=d-a

    k=d+1

    c=Mid(email, k, 1)

    if(a

  • 7/29/2019 12 class practicle file multimedia & web technology

    18/68

    Name



    Address



    Date Of Birth : Day

    1 2 3

    4 5 < option value="6">6

    7 8 9

    10 11 12

    13 14 15

    16 17 18

    19 20 21

    22 23 24

    25 26 27

    28 29 30

    31

    Month

    Jan Feb Mar

    Aprl MayJun

    JulyAug Sep

    OctNovDec

  • 7/29/2019 12 class practicle file multimedia & web technology

    19/68

    Year



    Email Id



    Output:

    -----------------------------------------------------------------------------------------------------------------------------------

  • 7/29/2019 12 class practicle file multimedia & web technology

    20/68

    Ex 9: Create a program the accepts the time from the system clock and accordingly displays aGood morning, Good Afternoon and Good Evening message to the user.

    -Greeting Acording to Time-

    sub wish()

    dim h

    h=Datepart("h",Now)

    if h>=1 and h=13 and h

  • 7/29/2019 12 class practicle file multimedia & web technology

    21/68

    -------------------------------------------------------------------------------------------------------------------------

    Ex 12: ,d izksxzke fyf[k, ftles For next Looping Statements dk mi;ksx djrs gq, FibonacciSeries generate fdft,A

    -Fibonacci Series-

    sub fib()

    dim a,b,c

    a=1

    b=1

    document.write("First 10 Fibonacci Series
    ")

    document.write(a & "" & b & "")

    for i=3 to 10

    c=cint(a)+cint(b)

    document.write(c & "")

    a=b

    b=c

    next

    end sub

  • 7/29/2019 12 class practicle file multimedia & web technology

    22/68

    Output:

    ---------------------------------------------------------------------------------

    Ex 13: Do While Loopdk mi;ksx djrs gq, Factorial SeriesKkr djus dkvbscript codefyf[k,A.

    -Factorial Number-

    sub fact(n)

    dim f,i

    f=1

    i=1

    do while(i

  • 7/29/2019 12 class practicle file multimedia & web technology

    23/68

    Output:

    ---------------------------------------------------------------------------------------------------------------------

    Ex 14: ,d izksxzke fyf[k, tksmultiplication of two matrices dks iznfkr djsA

    -Multiplication of Two Matrics-

    sub matmul()

    dim m1(3,3),m2(3,3),m3(3,3),count,i,j

    count=0

    msgbox("Enter First matrix")

    for i=0 to 2

    for j=0 to 2

  • 7/29/2019 12 class practicle file multimedia & web technology

    24/68

    m1(i,j)=inputbox("")

    next

    next

    msgbox("Enter Second matrix")

    for i=0 to 2

    for j=0 to 2

    m2(i,j)=inputbox("")

    next

    next

    document.write("
    Product of two Matrix
    ")

    for i=0 to 2

    for j=0 to 2

    for k=0 to 2

    m3(i,j)=cint(m3(i,j))+cint(m1(i,k))* cint(m2(k,j))

    next

    next

    next

    for i=0 to 2

    for j=0 to 2

    document.write(" " & m1(i,j))

    next

    document.write("
    ")

    next

    document.write("
    +
    ")

    for i=0 to 2

    for j=0 to 2

    document.write(" " & m2(i,j))

    next

    document.write("
    ")

    next

  • 7/29/2019 12 class practicle file multimedia & web technology

    25/68

    document.write("
    =
    ")

    for i=0 to 2

    for j=0 to 2

    document.write(" " & m3(i,j))

    next

    document.write("
    ")

    next

    end sub

    Output:

    --------------------------------------------------------------------------------------------------------------------------------------

    Ex 15: ,d izksxzke fyf[k, tks user ls buiqV ysdj Factorial fd x.kuk djs ijUrqrHkh ;nh l[;kprime number gksA

    -Prime to Factorial-

    sub ChkPrime(n)

  • 7/29/2019 12 class practicle file multimedia & web technology

    26/68

    dim i,prime,k

    prime=true

    for i=2 to cint(n)/2

    if (n Mod i)=0 then

    prime=false

    end if

    next

    if prime=true then

    fact(n)

    else

    document.write("
    The Number is Not Prime")

    end if

    end sub

    sub fact(n)

    dim f,i

    f=1

    i=1

    do while(i

  • 7/29/2019 12 class practicle file multimedia & web technology

    27/68

    Output:

    (16) response.write Command dk mi;ksx djrs gq, ,d fyf[k, rFkk

    vkmViqV ckmtj es iznfkZr fdft,A

    Output: My first ASP script!

  • 7/29/2019 12 class practicle file multimedia & web technology

    28/68

    ASP Variables

    (17) osfj,cy dks fMdys;j djds eku iznku djrs gq, bl eku dks mi;ksx es

    ysus gsrq vko;d Asp Code fyf[k,A

    Output: My name is: saurav

    (18) ,sjs dks fMdys;j djrs gq, bles lqjf{kr eku dsk czkmtj es iznfkr djus gsrq ,d , ,l

    ih dksM fyf[k,A

  • 7/29/2019 12 class practicle file multimedia & web technology

    29/68

    For i = 0 to 5

    response.write(famname(i) & "
    ")

    Next

    %>

    Output:

    ajay

    vijay

    ram

    Sita

    hanuman

    rahul

    (19) Html heading tag dkASP es mi;ksx djrs gq, ifj.kke dks screen ij iznfkr fdft,A

    Output:

    Heading 1

    Heading 2

  • 7/29/2019 12 class practicle file multimedia & web technology

    30/68

    Heading 3

    Heading 4

    Heading 5

    Heading 6

    (20) Asp es ,d dksM fyf[k, ftles le; ds vuqlkj greatting (good morning or good

    day) iznfkr gksA

  • 7/29/2019 12 class practicle file multimedia & web technology

    31/68

    (21)If ... Then ... Else Statement dk mi;ksx djrs gq, fo}kFkh ds izkIr

    ifj.kke ds vuqlkj grade iznfkr fdft,A

    = 75 then

    response.write("Passed: Grade A
    ")

    elseif Result >= 60 then

    response.write("Passed: Grade B
    ")

    elseif Result >= 45 then

    response.write("Passed: Grade C
    ")

    else

    response.write("Failed
    ")

    end if

    %>

    Output : passed Grade B

    (22) If..Then.Else Statement dk mi;ksx djrs gq, ,d asp dksM fyf[k, ftles orZeku

    ekg ds vuqlkj lnsk iznfkr gksA

    Option Explicit

    Dim m

    m = Month(Date)

    if m = 1 then

  • 7/29/2019 12 class practicle file multimedia & web technology

    32/68

    document.write ("A new year has arrived. What are your plans?")

    elseif m = 4 then

    document.write("April showers bring May flowers!")

    elseif m = 7 then

    document.write("Summer! Watermelon! Yayy!!")

    elseif m = 11 then

    document.write("Leaves all over the place")

    else

    document.write("No particular message for this month")

    end if

    Output: No particular message for this month

    ---------------------------------------------------------------------------------------------------------------

    -------------------------------------

    (23)Select Case dk mi;ksx djrs gq, ,d asp dksM fyf[k, ftles orZeku ekg ds vuqlkj

    lnsk iznfkr gksA

    Option Explicit

    Dim m

    m = Month(Date)

    Select Case m

    case 1

    document.write ("A new year has arrived. What are your plans?")

    case 4

    document.write("April showers bring May flowers!")

    case 7

    document.write("Summer! Watermelon! Yayy!!")

  • 7/29/2019 12 class practicle file multimedia & web technology

    33/68

    case 11

    document.write("Leaves all over the place")

    case else

    document.write("No particular message for this month")

    end select

    Output: No particular message for this month

    Conditional Statement

    (24) Do loop dk mi;ksx djrs gq, 1 ls 5 rd fd l[;k iznfkr fdft,A

    Output:

    1

    2

    3

    4

    5

  • 7/29/2019 12 class practicle file multimedia & web technology

    34/68

    -----------------------------------------------------------------------------------------------

    ----------------------------------

    (25) For Loop dk mi;ksx djrs gq, 1 ls 5 rd fd l[;kscreen ij iznfkr fdft,A

    Output:

    1

    2

    3

    4

    5

    -----------------------------------------------------------------------------------------------

    --------------------------------

    ASP Procedures(26) Procedures vFkoksubroutine dks fMdys;j djrs gq, bls call djus dkAsp dksM fyf[k,A

    izksfltj es nks la[;kvks dks tksMus dk dksM fy[kk x;k gS

  • 7/29/2019 12 class practicle file multimedia & web technology

    35/68

    You can call a procedure like this:

    Result:

    Or, like this:

    Result:

    Output:

    You can call a procedure like this:

    Result: 12

    Or, like this:

    Result: 12

    ASP Forms and User Input

    (27) Get esFkM dk mi;ksx djrs gq, ,d Form dk fuekZ.k fdft,A ftles textbox es ;qtj dk uke buiqV

    djk dj uke dks screen ij iznfkZr fdft,A

    Your name:

  • 7/29/2019 12 class practicle file multimedia & web technology

    36/68

    fname=Request.QueryString("fname")

    If fname"" Then

    Response.Write("Hello " & fname & "!
    ")

    Response.Write("How are you today?")

    End If

    %>

    Output:

    (28) Post esFkM dk mi;ksx djrs gq, ,d Form dk fuekZ.k fdft,A ftles textbox es ;qtj dk uke

    buiqV djk dj uke dks screen ij iznfkZr

    fdft,A

    Your name:

  • 7/29/2019 12 class practicle file multimedia & web technology

    37/68

    Output:

    (29) Radio button dk mi;ksx djrs gq, ,d Form dk fuekZ.k fdft,A ftles radio button ij clickdj fn, x,dkj ds uke dks pqudj dkj dk uke screen ij iznfkZr fdft,A

    Please select your favorite car:

    Volvo


    Saab


    BMW



  • 7/29/2019 12 class practicle file multimedia & web technology

    38/68

    if cars"" then

    Response.Write("

    Your favorite car is: " & cars & "

    ")

    end if

    %>

    Output:

    ASP Cookies

    (30) ,d cookie dk fuekZ.k fdft, tks osc lkbV dks foftV djus okys users fd la[;k iznfkr djs A

  • 7/29/2019 12 class practicle file multimedia & web technology

    39/68

    response.write " times before!"

    end if

    end if

    %>

    Output:

    You have visited this Web page 1 time before!

    ASP Request Object

    Use: The Request object is used to get information from a visitor.

    (31) Checkboxdk mi;ksx djrs gq, ,d Formdk fuekZ.k fdft,A ftles Check button ij clickdj fn, x,Qyks ds ukeks es ls

    ialn ds Qyks dks pqudj Qyks ds uke screen ij iznfkZr fdft,A

    Which of these fruits do you prefer:

    Apple

  • 7/29/2019 12 class practicle file multimedia & web technology

    40/68


    Orange


    Banana


    You like:

    Output:

    -----------------------------------------------------------------------------------------------

    ---------------------------------

    ASP Server Object

  • 7/29/2019 12 class practicle file multimedia & web technology

    41/68

    (32) Text Qkby dks open djds Read djus ds fy, ,d Asp code fyf[k,A

    Output:

    (33) ,d counter dk fuekZ.k fdft, ftlds }kjkvisit fd, tkus okys;qtj fd la[;k

    iznfkr djsA

  • 7/29/2019 12 class practicle file multimedia & web technology

    42/68

    'Set RS=FS.OpenTextFile(Server.MapPath("counter.txt"), 2, False)

    'RS.Write fcount

    'RS.Close

    Set RS=Nothing

    Set FS=Nothing

    %>

    This page has been visited times.

    Output: This page has been visited 12345 times.

    ASP TextStream Object

    (34) Text Qkby dks open djds Read djus ds fy, ,d Asp code fyf[k,A

    This is the text in the text file:

  • 7/29/2019 12 class practicle file multimedia & web technology

    43/68

    Output:

    This is the text in the text file:

    Hello! How are you today?

    (35) VsDlVQkby dks vksiu djds VsDlV Qkby ds fuffpr Hkkxdks jhM

    djus ds fy, ,d Asp code fyf[k,A

    This is the first five characters from the text file:

    Output:

    This is the first five characters from the text file:

    Hello

  • 7/29/2019 12 class practicle file multimedia & web technology

    44/68

    (36) VsDlVQkby dks vksiu djds VsDlV Qkby fd flQZ ,d ykbu dks jhM

    djus ds fy, ,d Asp code fyf[k,A

    This is the first line of the text file:

    Output:

    This is the first line of the text file:

    Hello!

    (37) VsDlVQkby dks vksiu djds VsDlV Qkby fd lHkh ykbu dks jhMdjus

    ds fy, ,d Asp code fyf[k,

    This is all the lines in the text file:

  • 7/29/2019 12 class practicle file multimedia & web technology

    45/68

    Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1)

    do while f.AtEndOfStream = false

    Response.Write(f.ReadLine)

    Response.Write("
    ")

    loop

    f.Close

    Set f=Nothing

    Set fs=Nothing

    %>

    Output:

    This is all the lines in the text file:

    Hello!

    How are you today?

    (38)VsDlVQkby dks vksiu djds VsDlV Qkby ds fdlh fuffpr Hkkx dks

    skip/NksMrs gq, ckdh Hkkx dks jhMdjus ds fy, ,d Asp code fyf[k,

    The first four characters in the text file are skipped:

  • 7/29/2019 12 class practicle file multimedia & web technology

    46/68

    f.Close

    Set f=Nothing

    Set fs=Nothing

    %>

    Output:

    The first four characters in the text file are skipped:

    o! How are you today?

    (39) VsDlVQkby dks vksiu djds VsDlV Qkby es ls fdlh ,d ykbu dks

    NksM dj ckdh ykbu dks jhMdjus ds fy, ,d Asp code fyf[k,

    The first line in the text file is skipped:

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    47/68

    The first line in the text file is skipped:

    How are you today?

    (40) VsDlVQkby dks vksiu djds VsDlV Qkby fd lHkh ykbu dks ykbu

    uEcj lfgr iznfkZr djus gsrq ,d Asp code fyf[k,A

    This is all the lines in the text file (with line numbers):

    Output:

    This is all the lines in the text file (with line numbers):

    Line:1 Hello!

    Line:2 How are you today?

    (41)

  • 7/29/2019 12 class practicle file multimedia & web technology

    48/68

    Get column number (How to get the column number of the current

    character in a file.)

    Output:

    He

    The cursor is now standing in position 3 in the text file

    ASP Components

    ASP AdRotator Component

    (42) ,d ,M jksVsVj dEiksusUV dk mi;ksx djrs gq, ,d foKkiu dk fuekZ.k fdft, tks

    czkmtj fd screen ij iznfkr gksA

    USE:- The ASP AdRotator component creates an AdRotator object that displays a different imageeach time a user enters or refreshes a page. A text file includes information about the images.

  • 7/29/2019 12 class practicle file multimedia & web technology

    49/68

    If url"" then Response.Redirect(url)

    %>

    NOTE: Because images are changed randomly, and because this page

    has few images to choose from, it will

    often display the same advertisement twice in a row.

    NOTE: The AdRotator does not work with Internet Information

    Server 7 (IIS7).

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    50/68

    ASP Browser Capabilities Component

    (43) Browser capabilities component dk mi;ksx dj mi;ksx fd, tk jgs ckmtj dk Vkbi ]ojtu ]

    vksijsfVx flLVe vkfn tkudkjh czkmtj fd screen ij iznfkr fdft, A

    Client OS

    Web Browser

    Browser version

    Frame support?

    Table support?

    Sound support?

    Cookies support?

    VBScript support?

    JavaScript support?

  • 7/29/2019 12 class practicle file multimedia & web technology

    51/68

    Output:

    Client OS unknown

    Web Browser Opera

    Browser version 3.60

    Frame support? True

    Table support? True

    Sound support? True

    Cookies support? True

    VBScript support? False

    JavaScript support? True

    ASP Content Rotator Component

    (44),d dUVsUV jksVsVj dEiksusUV dk mi;ksx djrs gq, ,d foKkiu dk fuekZ.k fdft, tks

    czkmtj fd screen ij iznfkr gksA RkFkk gj ckj

    tc Hkh ;qtj ist dks djs rc foKkiu ifjofrZr gksrk jgsA

    NOTE: Because the content strings are changed randomly in the text file, and this page has onlyfour content strings to choose from, sometimes the page will display the same content strings

    twice in a row.

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    52/68

    NOTE: Because the content strings are changed randomly in the text file, and this page has only four

    content strings to choose from, sometimes the page will display the same content strings twice in a row.

    ASP ADO

    USE:- ADO dk mi;ksx osc ist ds tfj, MkVkcsl dks ,Dlsl djus ds fy, fd;k tkrk gSA

    ASP Page ds tfj, MkVkcsl dk mi;ksx :-:

    (1) MkVkcsl ds lkFkADO dusDku LFkkfir fdft,

    (2) MkVkcsl dusDku dks vksiu fdft,

    (3) ADO recordset dks create fdft,

    (4) recordset dks vksiu fdft,

    (5) recordset ls vko;d MkVk dks izkIr djrs gS

    (6) recordset dks can djrs gS

    (7) connection dks can djrs gS

    (1) Create a DSN-less Database Connection

    < %

    set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"

    conn.Open "c:/webdata/northwind.mdb"%>

    (2) Create an ODBC Database Connection

    < %set conn=Server.CreateObject("ADODB.Connection")conn.Open "northwind"%>

    An ODBC Connection to an MS Access Database

    Here is how to create a connection to a MS Access Database:

    1. Open the ODBC icon in your Control Panel.

    2. Choose the System DSN tab.

    3. Click on Add in the System DSN tab.

    4. Select the Microsoft Access Driver. Click Finish.

    5. In the next screen, click Select to locate the database.

    6. Give the database a Data Source Name (DSN).

    7. Click OK.

    ADO Examples

  • 7/29/2019 12 class practicle file multimedia & web technology

    53/68

    Display

    (45) MS access fd Vscy lqjf{kr fjdksMks dks osc ist es iznfkr fdft,A

  • 7/29/2019 12 class practicle file multimedia & web technology

    54/68

    Output:

    -----------------------------------------------------------------------------------------------------------

    (46) fjdksMks dks Html Vscy es iznfkr fdft,A

    Display records in an HTML table

  • 7/29/2019 12 class practicle file multimedia & web technology

    55/68

    Output:

    (47)headers dks HTML Vscy es tksMuk rFkk HTML Vscy es dyj MkyukA

  • 7/29/2019 12 class practicle file multimedia & web technology

    56/68

    response.write("" & x.name & "")

    next%>

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    57/68

    Queries

    (48) osc ist es flQZ mUgh fjdksM dks iznfkr fdft, ftudk uke a kCn ls

    kq: gksrk gSA

  • 7/29/2019 12 class practicle file multimedia & web technology

    58/68

    %>

    Output:

    -------------------------------------------------------------------------------------------------------------

    (49) osc ist es flQZ 50 lky ls vf/kd mae okys yksxks ds fjdksM iznfkr

    fdft,A

  • 7/29/2019 12 class practicle file multimedia & web technology

    59/68

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    60/68

    (50)fjdkMZ dks Filter djd osc ist es iznfkZr fdft,A

    Choose Country

  • 7/29/2019 12 class practicle file multimedia & web technology

    61/68

    rs.MoveNext

    loop

    rs.Close

    set rs=Nothing %>

    Companyname

    Contactname

    Country

  • 7/29/2019 12 class practicle file multimedia & web technology

    62/68

    set rs=Nothing

    set conn=Nothing%>

    Output:

    SORT

    (51) fjdksMks dks fQYM use ds vuqlkj vlsfUMx vkMZj es lksVZ djds

    osc ist es iznfkr fdft,A

  • 7/29/2019 12 class practicle file multimedia & web technology

    63/68

    Output:

    (52) fjdksMks dks fQYM use ds vuqlkj fMlsfUMx vkMZj es lksVZ djds

    osc ist es iznfkr fdft,A

    Sort the records on a specified fieldname descending

  • 7/29/2019 12 class practicle file multimedia & web technology

    64/68

    %>

    Output:

    (53) ,d asp code fyf[k, ftles ;qtj viuh vko;drk ds vuqlkj dksye dks

    lksVZ djus ds fy, pqu ldsA

  • 7/29/2019 12 class practicle file multimedia & web technology

    65/68

    Company

    Contact

  • 7/29/2019 12 class practicle file multimedia & web technology

    66/68

    loop

    rs.close

    conn.close

    %>

    Output:

    Recordset Object

    (54) Vscy ds izFke dkWye ds izFke nks fjdksMZ dks rFkk bl ipkr izFke

    fjdksMZ ds izFke rhu dkWye dks osc ist ij iznfkr fdft,A

    GetRows

  • 7/29/2019 12 class practicle file multimedia & web technology

    67/68

    'The second number indicates what recordnumber to start on

    p=rs.GetRows(2,0)

    response.write("

    This example returns the value of the first column in the first two

    records:

    ")

    response.write(p(0,0))

    response.write("
    ")

    response.write(p(0,1))

    response.write("

    This example returns the value of the first three columns in the first

    record:

    ")

    response.write(p(0,0))

    response.write("
    ")

    response.write(p(1,0))

    response.write("
    ")

    response.write(p(2,0))

    rs.close

    conn.close

    %>

    Output:

  • 7/29/2019 12 class practicle file multimedia & web technology

    68/68

    (55)Vscy fd flQZ strings dks osc ist ij iznfkr fdft,A

    GetString

    Output: