SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A problem with Javascript and ASP

    im making a submit form with several value sending with a javascript. like this

    function setflash() {
    {
    document.form1.setver.value= "flash";
    }

    }
    function sethtml() {
    {
    document.form1.setver.value= "html";
    }

    }

    then how i use asp to load the value and play different
    sites.
    The Effect can check here: http://www.vulcan.com

  2. #2
    SitePoint Zealot Drew630's Avatar
    Join Date
    Nov 2001
    Location
    Maryland
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you need to do in your form that calls the javascript, is to have a hidden variable. Then, when your form is submitted, call the function in javascript to set the hidden variable to either flash or HTML by examining which one is selected. Once you set the hidden variable, then your asp file can access that hidden variable and load the page accordingly.

    I know that this is a quick and dirty answer. Did you follow, or do you need some code? If so, post some of your code so I can see what you already have.

    Drew
    ~Drew

    There Is No Greater Joy Than Soaring High On The Wings Of Your Dreams, Except Maybe The Joy Of Watching A Dreamer Who Has Nowhere To Land But In The Ocean Of Reality.

  3. #3
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know how to set the hidden variable , but i dont know much about asp so i do not know how to write a programme to load the variable and load the page accordingly. so can u give me some code?

  4. #4
    SitePoint Zealot Drew630's Avatar
    Join Date
    Nov 2001
    Location
    Maryland
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For future reference, if you have an ASP question, then post it in the asp forum

    Now then. What you need to do is call the ASP program from the form after you submit it. I will assume that you know how to do that.

    For arguments sake, I am calling you hidden variable "hidden".
    Here is roughly what the ASP code should look like:

    Code:
    <%
    dim var
    
    var = request.form("hidden")
    if var = "FLASH" then 
       response.redirect "flashpage"
    else
       response.redirect "htmlpage.htm"
    end if
    %>
    Here flashpage is the name of the page done with flash and htmlpage is the name of the html page.

    What I would do is put this code snippet at the top of your page with the form to determine the load type, rename the form page with an .asp extension, and in the form, have the submit call the same page.
    Make sure that the code snippet is before ANY HTML code.
    IE...

    Code:
    <form name="myform" method="get" action="Pagename.asp">
    // form stuff
    </form>
    Do you follow that?

    Drew
    ~Drew

    There Is No Greater Joy Than Soaring High On The Wings Of Your Dreams, Except Maybe The Joy Of Watching A Dreamer Who Has Nowhere To Land But In The Ocean Of Reality.

  5. #5
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot


Bookmarks

Posting Permissions

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