[thelist] Javascript: url variable to form text field

Tom Dell'Aringa pixelmech at yahoo.com
Thu Mar 13 22:17:44 CST 2003


--- Hassan Schroeder <hassan at webtuitive.com> wrote:

> Uh, except then there's no input field at all if someone has JS
> turned off, and even with JS this kind of construction is more
> difficult to maintain (like -- you decide to add a class to that
> input later, need to change the element name, etc.).
> 
> Why not just:
> 
>    <input type="text" name="urlVariable" />
> 
> with something like this in the document head:
> 
> <script type="text/javascript">
> function setInput()
> {
> 	document.forms[0].urlVariable.value = url["foo"};
> }
> window.onload=setInput;
> </script>
> 
> Just a suggestion...

Thats fine Hassan, except that if they have JavaScript turned off,
your JavaScript won't work, just like everyone elses.

I do agree that your method for writing the variable to the input is
a better way obviously, providing they have JS on.

The poster however was wanting to write the variable right in his
input so I was trying to accomodate him :)

Tom

=====
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
http://www.pixelmech.com/
var me = tom.pixelmech.webDeveloper();

http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com


More information about the thelist mailing list