Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post

    Javascript and ASP

    I did a search but found nothing, I guess the old db didn't get ported over from pre june 2002, I can remember that I answered this before but I guess age is catching up to me. I want to know how to access an ASP function through javascript, and I want to pass a value to the ASP function from javascript. ie.

    if ( document.form.elementname.value == "" || <% ASPfunction(+document.form.elementname.value+) %> == "True")
    { //do something }

    all help is appreciated, thanks.
    I would rather be a lion for a day than a lamb that lives forever.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    you CAN'T do that! Since ASP code is executed on the server-side, these codes executes first to GENERATE HTML/Javascript codes on the client. The javascript codes are then executed on the client based on some user events.

    What you can only do is insert ASP codes inside javascript like this:

    <script>
    var count = <%=recordCount%>;
    var blah = "<%=strBlah%>";
    var uname = "<%=GetUserName()%>";
    <%=GenerateJavaScriptArray()%>
    </script>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    DOH!
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

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