Forum Moderators: open

Message Too Old, No Replies

calling a function within document.write

Functions not working within document.write

         

Tamarick

2:59 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



I'm just trying to write a simple line of html, but the JS functions won't work.

<script type="text/javascript">
document.write('<li><a href="#" id="someID" onmouseover="'+some.Function('var1')+'">Widgets</a></li>');
</script>

Any Ideas?

BlobFisk

3:06 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no need to concatenate the function call, you merely need to escape the apostrophes:

<script type="text/javascript">
document.write('<li><a href="#" id="someID" onmouseover="some.Function(\'var1\')">Widgets</a></li>');
</script>

HTH

Tamarick

3:20 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



Excellent! That worked perfect. Thanks!