Hi:
Can anyone look at the code & find what wrong it has.?
I have a HELLO button in a <table> tag & also written a function to redirect to Hello.html when HELLO button is pressed.
The problem that I have is:
1. The HELLO button is never seen as a button instead seen in similar pattern as item1, item2, item3.
2. When I click the HELLO, the function redirect() won't fire.
Thanks in advance.
The Code is as under.
----------------------------------------------------------
<HTML>
<head>
<style type="text/css">
<!--
body
{
margin:0px;
font-family : "Verdana, Arial, Helvetica, sans-serif";
font-size : 12pt;
}
#ini0, #ini1, #ini2
{
border:2px solid #CCCCCC;
height:20px;
width:100px;
padding:10px;
background-color:#EEEEEE;
cursor:hand;
position:relative;
font:normal 12px "Verdana, Arial, Helvetica, sans-serif";
}
#menu0, #menu1, #menu2
{
width:100px;
position:absolute;
visibility:hidden;
border:1px solid #CCCCCC;
cursor:hand;
font:normal 12px "Verdana, Arial, Helvetica, sans-serif";
}
-->
</style>
<script language="text/javascript">
<!--
function redirect(url)
{
location.replace(url);
}
-->
</script>
<script language="tex/javascript">
var a = new Array();
var i = 0;
while (i!=3)
{
a = document.getElementById('menu'+i);
i++;
}
i = 0;
while (i!=a.length)
{
a.style.top=document.getElementById('ini'+i).offsetHeight;
a.style.left=document.getElementById('ini'+i).offsetWidth*i++;
}
function show(menu)
{
i = 0;
while (i!=a.length)
{
a.style.visibility='hidden';
i++;
}
if (a[menu])
a[menu].style.visibility='visible';
}
</script>
</head>
<body onClick="show('none')">
<span onMouseOver="show('0')" id="ini0">item 1</span><span onMouseOver="show('1')" id="ini1">item 2</span><span onMouseOver="show('2')" id="ini2">item 3</span>
<form name="frm1" action ="Hello.html" method=POST>
<table id="menu0" onMouseLeave="show('none')">
<tr><td>Option A</td></tr>
</table>
<table id="menu1" onMouseLeave="show('none')">
<tr><td>Option B</td></tr>
<tr><td>Option B</td></tr>
</table>
<table id="menu2" onMouseLeave="show('none')">
<tr><td>Option C</td></tr>
<tr><td>Option C</td></tr>
<tr><td>Option C</td></tr>
</table>
<table>
<tr>
<td><input type=button value=HELLO size=10 onClick="javascript:redirect('Hello.html');">
</table>
</form>
</body>
</html>
Can anyone look at the code & find what wrong it has.?
I have a HELLO button in a <table> tag & also written a function to redirect to Hello.html when HELLO button is pressed.
The problem that I have is:
1. The HELLO button is never seen as a button instead seen in similar pattern as item1, item2, item3.
2. When I click the HELLO, the function redirect() won't fire.
Thanks in advance.
The Code is as under.
----------------------------------------------------------
<HTML>
<head>
<style type="text/css">
<!--
body
{
margin:0px;
font-family : "Verdana, Arial, Helvetica, sans-serif";
font-size : 12pt;
}
#ini0, #ini1, #ini2
{
border:2px solid #CCCCCC;
height:20px;
width:100px;
padding:10px;
background-color:#EEEEEE;
cursor:hand;
position:relative;
font:normal 12px "Verdana, Arial, Helvetica, sans-serif";
}
#menu0, #menu1, #menu2
{
width:100px;
position:absolute;
visibility:hidden;
border:1px solid #CCCCCC;
cursor:hand;
font:normal 12px "Verdana, Arial, Helvetica, sans-serif";
}
-->
</style>
<script language="text/javascript">
<!--
function redirect(url)
{
location.replace(url);
}
-->
</script>
<script language="tex/javascript">
var a = new Array();
var i = 0;
while (i!=3)
{
a = document.getElementById('menu'+i);
i++;
}
i = 0;
while (i!=a.length)
{
a.style.top=document.getElementById('ini'+i).offsetHeight;
a.style.left=document.getElementById('ini'+i).offsetWidth*i++;
}
function show(menu)
{
i = 0;
while (i!=a.length)
{
a.style.visibility='hidden';
i++;
}
if (a[menu])
a[menu].style.visibility='visible';
}
</script>
</head>
<body onClick="show('none')">
<span onMouseOver="show('0')" id="ini0">item 1</span><span onMouseOver="show('1')" id="ini1">item 2</span><span onMouseOver="show('2')" id="ini2">item 3</span>
<form name="frm1" action ="Hello.html" method=POST>
<table id="menu0" onMouseLeave="show('none')">
<tr><td>Option A</td></tr>
</table>
<table id="menu1" onMouseLeave="show('none')">
<tr><td>Option B</td></tr>
<tr><td>Option B</td></tr>
</table>
<table id="menu2" onMouseLeave="show('none')">
<tr><td>Option C</td></tr>
<tr><td>Option C</td></tr>
<tr><td>Option C</td></tr>
</table>
<table>
<tr>
<td><input type=button value=HELLO size=10 onClick="javascript:redirect('Hello.html');">
</table>
</form>
</body>
</html>