If someone goes to the URL; http://www.mywebsite.com/index.html?name=jason I then want the textbox with ID 'name' to have the "jason" text automatically in there. What is the best way to go about it and if you have an example that would be great. Any idea what this process is called exactly...passing a string from url? Thanks!
Thanks Unni krishnan Is there any way without a body onload? Like just in JS? Thanks again..much appreciated!
Thanks clarky_y2k3 Tried both ways but it does not input the url text from after the "=" into the textbox. Code I have is as follows; <body onLoad="capture"> <SCRIPT LANGUAGE="javascript"> function capture() { var urlValue = window.location; var urlText = urlValue.toString(); var start = urlText.indexOf("=") + 1; var nameText = urlText.substring(start, urlText.length); document.getElementById('name').value = nameText; } </SCRIPT> <form> <div class="div_texbox"> <input name="name" class="name" id="name" value="" /> </div> </form> </body> Code (markup):
Try writing the script portion in the HEAD tag. If you don't want it on the onLoad event try writing the code that Clarky specified after the 'capture' function in the script tags. Hope this will work fine.
you have to add () here: <body onload="capture[B]()[/B]"> Code (markup): or put window.onload = capture Code (markup): before </script>