FIXED!
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Page Title -->
<title>Hiding Selected List Items</title>
<!-- Meta Block -->
<meta content="text/html; charset=iso-8859-1" http-equiv="content-type" />
<meta content="Hiding Selected List Items" name="description" />
<meta content="Hiding, Selected, List, Items" name="keywords" />
<meta content="all,index,follow" name="robots" />
<meta content="noodp" name="msnbot" />
<meta content="global" name="distribution" />
<!-- Javascript Scripts -->
<script type="text/javascript">
function doSomething() {
var x = document.getElementById('selItems').value;
var parag = document.getElementById('li' + x);
if (parag.style.display == 'none') {
parag.style.display = 'block';
} else {
parag.style.display = 'none';
}
}
</script>
</head>
<body>
<div id="page">
<ul>
<li id="li1">Item1</li>
<li id="li2">Item2</li>
<li id="li3">Item3</li>
</ul>
<input type="button" onclick="doSomething();" value="Show / Hide" />
<select id="selItems">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
</body>
</html>
Your main problem was the handling of the form within the page. You don't need a form in this instance, nor do you need to pass any values into the javascript function you are calling. You can select the value from the DropDownBox by grabbing the whole element from the DOM Tree with document.getElementById(id);.
Bookmarks