PDA

View Full Version : :: help with parameters in a script ::


babelfish
07-16-2002, 03:38 PM
ok im slowly learning jscript but i dont get this bit:

can someone enlighten me how to do this:

<code>

<script language="JavaScript" type="text/JavaScript">
<!--
function submenu(item)
{
document.write('<div id="\'+item+\'layer" class="dd">');
}
//-->
</script>

<body onLoad="submenu(help);">

</code>

i will basically have quite a few lines of similar code but there will be one word different - and i dont wanna use arrays as this isnt flexible enough for me :)

so how can i get it to output?

thanks!

tamienne
07-16-2002, 03:57 PM
Originally posted by babelfish

document.write('<div id="\'+item+\'layer" class="dd">');


The quotes aren't quite right. Try something like this instead..
document.write("<div id='"+item+"layer' class='dd'>");

babelfish
07-16-2002, 04:00 PM
hehe - i was just returning to say that i cracked it :)

anyway - thanks for the input - same as what i eventually came up with - i reallynedd to learn this not just use trial and error :) i knew the rough syntax but was just a bit out :)