Results 1 to 6 of 6

Thread: sending variable to a new page

  1. #1

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409

    sending variable to a new page

    what im trying to do is send a number to a page that the user opens im trying to do it in java what i have so far is:


    page 1

    <a href = "http://wherenewpageis.html?send=1">test send</a>

    page http://wherenewpageis.html

    <script language = "javascript">
    document.writeln(send);
    </script>


    im not shure if im even doing it remotly right im just kindof guessing that the ?send=1 makes a varble on the page its loading called send and sets it to 1 but it seems thats not the case or if it is im doing something else wrong please tell me how to do it or what im doing wrong.

    thanx

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    No it doens't make a variable on the page (unless you are using a server-side method to retrieve it rather than JavaScript). You will need to use a script to find all the arguments in the query string. I think I have one on my site at http://www.rickbull.co.uk/tutorials/...t%20Downloads/ which you can use if you like.

  3. #3

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409
    thanks for the script rick.

    now i have another quaestion how can you detect if they havent put any parameter in the adress

  4. #4
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Well you could make up another function from the script I gave you. Let me do that, reupload it then I'll post back here.

  5. #5
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    OK, I've updated it http://www.rickbull.co.uk/tutorials/...t%20Downloads/ - there's now a new function hasArgument, just pass in whatever argument name you want. E.g. this will return whether the argument 'user' is present:

    Code:
    alert(hasArgument('user'));

  6. #6

    Thread Starter
    Hyperactive Member dogfish227's Avatar
    Join Date
    Oct 2002
    Location
    GA
    Posts
    409
    ok got it thanks again

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