I am trying to change the content on click of the button.The following is the code
HTML CODE
<SCRIPT LANGUAGE=”JavaScript” SRC=”scr.js”>
</SCRIPT>
</head>
<body>
<table border=”0″ align=”center” >
<tr>
<td class =”three” ><u>April Class Listing-2007</u></td></tr></table>
<form action=”” name=”form1″>
<TABLE BORDER=”0″ cellspacing=10 cellpadding=10 align=”center” >
<TR>
<TH class=”three”>Training Location :</TH>
<TD ><select id=”location”>
<option value=”atlanta”>Atlanta</option>
<option value=”seattle”>Seattle</option>
<option value=”tampa”>Tampa</option>
<option value=”virtual”>virtual</option></select></TD><td><input type=”button” value=”submit” onclick=”inserttab()”>
</TR>
</form>
</table>
<br><br>
<div name=”i1″ class=”eight”><table border=1 bordercolor=’black’ cellspacing=0 cellpadding=2 class=’four’ align=’center’><tr class=’six’><td>Coursename<td>Date<td>Time<td>Seats<td>Instructor<td>Room</tr><tr><td>Intro to sql<td>Tuesday,April 17th<td>8:30-5.00<td>20<td>Scott/Toombs/</tr></table></span></span>
</body>
JAVAscript
window.myvalue = 0;
window.myvalue1=0;
var output = document.getElementById(“i1”);
function getValue()
{
myvalue = myvalue+1;
}
function getValue1()
{
myvalue1 = myvalue1+1;
}
function inserttab()
{
if (document.getElementById(“location”).value==”atlanta”)
{
if(myvalue<=0)
{
alert(myvalue);
var x=document.getElementsByName(“kala”);
x.=”<h1>Hello</h1>”;
document.getElementById(“i2″).style.visibility=”hidden”;
getValue();
}
}
if (document.getElementById(“location”).value==”seattle”)
{
if (myvalue1<=0)
{
alert(myvalue1);
document.getElementById(“i2″).style.visibility=”visible”;
document.getElementById(“i1″).style.visibility=”hidden”;
getValue1();
}
}
}
whenever user selects a value from drop down and hits the button i should be able to dynamically create a Table. at the same locationI was using insertadjacentHTMl but it doesnt work in Mozilla.Help is appreciated.