Results 1 to 3 of 3

Thread: Javascript: Can't you have VB script in it??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Edmonton, Alberta Canada
    Posts
    192

    Javascript: Can't you have VB script in it??

    Hi,
    I'm trying to create a javascript function that has some VB script... but it seems as once the page loads the VB script is executed without a call to the function. Is this not possible... how can I make it happen??

    -------------------------------------------------------
    function rotate(srcimage,direction){
    n=n+direction;
    if (n==allImages) n=0;
    if (n==-1) n=allImages-1;

    <%
    if not rsProdSpecs.EOF then
    rsProdSpecs.MoveNext
    eProdImage = rsProdSpecs("img")
    else
    end if
    %>


    document.images[srcimage].src="images/productImages/<%=eProdImage%>";

    }

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

    Thanks!

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Javascript: Can't you have VB script in it??

    That's because the javascript is a CLIENT side script while the VBScript is a SERVER side script (ala ASP).... the server side scripting always runs first and sends the output to the browser... then and only then would the breowser be able to run the javascript.

    based on what I see in the code there, I'm not sure what the problem is.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Javascript: Can't you have VB script in it??

    Not entirely true. VBScript is also a client-side scripting language in Internet Explorer (and only Internet Explorer, so it's not a terribly wise choice of client side language).

    Although, the <% ... %> syntax suggests ASP to me. As techgnome points out you need to be clear on the difference between server side/client side scripting.

Posting Permissions

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



Click Here to Expand Forum to Full Width