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
Printable View
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
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
My bad, It's location.href
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 =).
Hope it helpedCode:<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>