Mick White wrote:
Frances wrote:
<html>
<head>
<script>
function doIt() {
var list = document.forms[0].product;
var selItem = list.options[list.selectedIndex].value;
^^^^^^^
</head>
list = document.forms[0].product; // Now "list" is global.
and where is this var declaration? if I put it outside function then
function can't read it.. if I put it inside function then it can't be
read outside function.. what am I missing here? how do you OUTSIDE
functions var's you have processed inside functions? thank you very
much.. again here is situation:
<html>
<head>
<script>
function doIt() {
var list = document.forms[0].product;
var selItem = list.options[list.selectedIndex].value;
^^^^^^^
</head>
<body>
<select name="product" onChange="doIt()"> ... </select>
[...............]
<script>
document.writeln('<div id="' + selItem + '">');// var not being
^^^^^^^^ // read here..
// how do I pass var from function to here?
</script>
</body>