[Javascript] Writing to Document after a function is executed.

Peter-Paul Koch gassinaumasis at hotmail.com
Sun Mar 25 10:16:43 CST 2001


><SCRIPT>
>functing bla()
>{
>var colors = new Arrays("Yellow", "blue", "red");
>}
><SCRIPT>

Syntax error: 'new Arrays' should be 'new Array'.

><FORM>
><INPUT TYPE="Text" onChange="bla();">
></FORM>

Possible, but why would you want to do this? Why not initialize the array 
immediately (ie. not in a function)?

><SCRIPT>
>document.writeIn(colors[0])
></SCRIPT>

If you put directly in your page it'll give an undefined error because 
colors[0] isn't yet defined when the browser tries to execute this bit of 
script (ie. directly when it has been received from the server). Solution: 
initialize the array directly and get rid of the onChange.

Syntax error: 'writeIn' should be 'write' or 'writeln' (small l instead of 
capital I)

ppk

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the Javascript mailing list