Results 1 to 4 of 4

Thread: Fill HTML input box?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    Fill HTML input box?

    Is there a way you can tell an HTML code (from the URL) to fill a input box with a value?

    Something like

    index.htm?txt1=name

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    No, but you can do it with JavaScript, using the window.location variable I think, and then parse it out...

    I can make an example if you want
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    My bad, It's location.href
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  4. #4
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Here's a rather undymanic example, but it should do about what you say, just pass txt1=yourtext, and and it should parse it ok =).

    Code:
    <html>
    
    <body>
    
    <form name=myform>
    <input type=text name=txt1>
    </form>
    
    <script>
    var loc=location.href;
    if (loc.indexOf("txt1=") > -1) {
    
    	document.myform.txt1.value = loc.substr(loc.indexOf("txt1=")+5,loc.length);
    
    }
    </script>
    
    
    </body>
    
    </html>
    Hope it helped
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

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