Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    7

    Unanswered: diff between <% %> and <SCRIPT...> ????

    Hi

    Hope this question isn't too basic - please help anyway!

    I am to make a little web application using ASP.

    What is the difference between declaring VBScript in <% here %> and <SCRIPT LANGUAGE="VBSCRIPT> here </SCRIPT> ??

    I can't tell but I get differing degrees of success when I code with either of them.

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778

    Re: diff between <% %> and <SCRIPT...> ????

    server side / client side respectively

    Originally posted by KewellMagic
    Hi

    Hope this question isn't too basic - please help anyway!

    I am to make a little web application using ASP.

    What is the difference between declaring VBScript in <% here %> and <SCRIPT LANGUAGE="VBSCRIPT> here </SCRIPT> ??

    I can't tell but I get differing degrees of success when I code with either of them.

  3. #3
    Join Date
    Oct 2003
    Posts
    706

    Exclamation

    Also remember... when using ASP it is really easy to assume that "the client is using Microsoft Windows(R), Of Course." Microsoft would love for you to assume that, but it's not a safe assumption; not at all.

    When designing applications for the web, I strive to produce systems that require as little client-side programming as possible; that's usually "none at all." This is what creates a truly portable application, hence the greatest number of potential customers who can actually use the site.

    The world is full .. and always will be .. of "non Windows" platforms, and plenty of competitors are just a click away from your own URL. Obviously this does not apply so much when you're building an internal-only (intranet) application, but even in that case I think that this way of thinking produces better, longer-lasting code.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  4. #4
    Join Date
    Sep 2003
    Location
    Australia
    Posts
    7
    thanks guys

    anyone know of an online resource that explains how to mix client-side and server-side VBscript on the one page?


    sundial: I would try another way but this project has specifically asked for use of client and server side code using VBscript only

  5. #5
    Join Date
    Oct 2003
    Posts
    706

    Cool

    Originally posted by KewellMagic
    thanks guys
    sundial: I would try another way but this project has specifically asked for use of client and server side code using VBscript only
    Thou $halt Do What Thy Cu$tomer Want$!
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  6. #6
    Join Date
    Nov 2003
    Location
    Australia
    Posts
    4

    Re: diff between <% %> and <SCRIPT...> ????

    Simple,
    <% depicts the opening of server side code %> is the end of server side code
    .... of course this
    <%@ Language="VBSCRIPT" %>
    defines the language of the ASP page and must be at the top of the page (but not under .net(u can have multiple instances with .net))

    <SCRIPT LANGUAGE="VBSCRIPT> here </SCRIPT>

    is client side
    (y would any1 want to use vbscript in a web browser? Javascript is much better there....

    to chop and change between the 2 modes (client server) u just use <% and %>

    eg (sorry this example is in jscipt, but for the sake of showing client/server integration, it is exactly the same

    <%@ Language="JScript" %>
    <%

    %>
    <HTML>
    <HEAD>
    <TITLE>CSV to graphics</TITLE>
    </HEAD>

    <BODY>
    <%
    // need to set key word searches and the location within the arrray.....in other
    // words the column number minus 1 (it is an javascript array after all)
    $location =2
    z=0;
    $key_words = new Array()
    $key_words[0]="approve";
    $key_words[1]="cleared";
    // of course some kind of counting system must be added and set to 0
    $key_words_score = new Array()
    $key_words_score[0]=0;
    $key_words_score[1]=0;
    var $data;
    var data_array = new Array();
    fso = new ActiveXObject("Scripting.FileSystemObject");
    $doc="C:/Inetpub/wwwroot/csv/dummy.csv"
    file = fso.OpenTextFile($doc, 1, true);
    while (!file.AtEndOfStream)
    {
    $data=file.ReadLine();
    data_array = $data.split(",");
    i=0;
    while (i!= $key_words.length)
    {
    if(data_array[$location].search($key_words[i])!=-1){$key_words_score[i]+=1}
    i++
    }
    z++;
    }

    i=0;
    total=0;
    graphic_data="height=400&width=500&label=y&legend= y&3d=y";
    while (i!= $key_words.length)
    {
    graphic_data+="&"+$key_words[i]+"="+$key_words_score[i]
    total+=$key_words_score[i]
    i++
    }
    graphic_data+="&Unaccountable="+(z-total)
    %>
    <br><br>
    <table width=100% cellpadding=5 cellspacing=5 border=0 ID="Table1">
    <tr><td><img id="graph" name="graph" src="graphics/bar.ashx?<%=graphic_data%>"></td></tr>
    <tr><td><img id="Img1" name="graph" src="graphics/plot.ashx?<%=graphic_data%>"></td></tr>
    <tr><td><img id="Img2" name="graph" src="graphics/pie.ashx?<%=graphic_data%>"></td></tr>
    <tr><td><img id="Img3" name="graph" src="graphics/piethreed.ashx?<%=graphic_data%>"></td></tr>
    </table>


    <%
    file.Close();

    %>
    </body>
    </html>


    What is the difference between declaring VBScript in <% here %> and <SCRIPT LANGUAGE="VBSCRIPT> here </SCRIPT> ??


    Hope that answers a few more questions, if not u can email me at jack_ed_ripper@hotmail.com
    I can't tell but I get differing degrees of success when I code with either of them. [/SIZE][/QUOTE]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •