[thelist] Javascript: url variable to form text field

Joshua Olson joshua at waetech.com
Thu Mar 13 17:49:45 CST 2003


----- Original Message -----
From: "michael grover" <mike at michaelgrover.com>
Sent: Thursday, March 13, 2003 2:46 PM


> > <input type="text" value="
> > <script language="JavaScript" type="text/javascript">
> > document.write(url["foo"]);
> > </script>
> > " />
>
> I tried both those examples and found that the text box terminates at
> the end of  of the <script language="JavaScript" type="text/javascript">
>  I also tried encapsulating the entire form with <script
> language="JavaScript"></javascript> but then the entire form dissappeared.

Hey Mike,

Yes, I think I provided some bad code!  The document.write should be used to
output the ENTIRE input tag as it is not possible to put a tag within a tag.
I'm surprised nobody else mentioned this!

So, something like this:

<script language="JavaScript" type="text/javascript">
  document.write('<input type="text" value="' + url["foo"] + '" />');
</script>

Sorry bout that.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list