Hi im having problem with this javaScript, in IExplorer didnt work, in firefox works perfect..
the idea is that when you click in the “otra” option the div below appear, and when you select another diferent from “otra” the div dissapear….
im new in java script i beggin learn a few days ago because in my work i need it, i hope you can help me….
my english is not the best, i hope you can understand.
thanks
Att:
Alejandro Herrera
[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>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Adiohawk</title>
</head>
<body>
<form action=”#” method=”post”>
<script type=”text/javascript”>
function toggle(sDivId) {
var oDiv = document.getElementById(sDivId);
oDiv.style.display = (oDiv.style.display == “none”) ? “block” : “block”;
};
function toggle2(sDivId) {
var oDiv = document.getElementById(sDivId);
oDiv.style.display = (oDiv.style.display == “block”) ? “none” : “none”;
}
</script>
<select name=”universidad” class=”input2″>
<option value=”” selected=”selected” ></option>
<optgroup label=”Bogota” >
<option onclick=”toggle2(‘divContent2’)” value=”impsem 1″>impsem 1</option>
<option onclick=”toggle2(‘divContent2’)” value=”impsem 2″>impsem 2</option>
<option onclick=”toggle2(‘divContent2’)” value=”impsem 3″>impsem 3</option>
</optgroup>
<optgroup label=”Medellin”>
<option onclick=”toggle2(‘divContent2’)” value=”impsem 4″ >impsem 4</option>
</optgroup>
<option onclick=”toggle(‘divContent2’)” value=”otra” >Otra</option>
</select>
<div id=”divContent2″ style=”padding:0px; display:none”>
<input type=”text” name=”otra” />
</div>
</form>
</body>
</html>