befab
11-02-2005, 06:07 PM
Hello,
I have the following code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function switchDiv(div1,div2,div3,div4,div5) {
document.getElementById(div1).style.display = 'block';
document.getElementById(div2).style.display = 'none';
document.getElementById(div3).style.display = 'none';
document.getElementById(div4).style.display = 'none';
document.getElementById(div5).style.display = 'none';
}
</script>
</head>
<body>
<a href="#" onClick="switchDiv(name1, name2, name3, name4, name5);">Trial 1</a><br>
<a href="#" onClick="switchDiv(name2, name1, name3, name4, name5);">Trial 2</a><br>
<br>
<div id="name1">DIV1</div>
<div id="name2">DIV2</div>
<div id="name3">DIV3</div>
<div id="name4">DIV4</div>
<div id="name5">DIV5</div>
</body>
</html>
I keep getting an object required javascript error. Does anyone know why this is occurring? I'm sure it's something simple, but I'm not sure what it is.
Thanks in advance for any help you can provide me with!
I have the following code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function switchDiv(div1,div2,div3,div4,div5) {
document.getElementById(div1).style.display = 'block';
document.getElementById(div2).style.display = 'none';
document.getElementById(div3).style.display = 'none';
document.getElementById(div4).style.display = 'none';
document.getElementById(div5).style.display = 'none';
}
</script>
</head>
<body>
<a href="#" onClick="switchDiv(name1, name2, name3, name4, name5);">Trial 1</a><br>
<a href="#" onClick="switchDiv(name2, name1, name3, name4, name5);">Trial 2</a><br>
<br>
<div id="name1">DIV1</div>
<div id="name2">DIV2</div>
<div id="name3">DIV3</div>
<div id="name4">DIV4</div>
<div id="name5">DIV5</div>
</body>
</html>
I keep getting an object required javascript error. Does anyone know why this is occurring? I'm sure it's something simple, but I'm not sure what it is.
Thanks in advance for any help you can provide me with!