Hi,
I just start learning javascript, so I try some easy functions. But I do not know why this one (below) do not work. PLZ help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<script language="JavaScript1.3">
<!--
function vote(a)
{
var a = 0;
if(document.form1.bad==true)
{
a = 1;
alert(a);
}
else if(document.form1.bad==false)
{
a = 0;
alert(a);
}
//-->
</script>
</head>
<body bgcolor="#000033" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="form1">
<table width="80%" border="1" cellspacing="3" cellpadding="3">
<tr>
<td rowspan="2"><img src=http://www.webdeveloper.com/forum/archive/index.php/""></td>
<td><input name="bad" type="radio">Schlecht</td>
<td><input name="bad" type="radio">Gut</td>
<td><input name="bad" type="radio">Geil</td>
<td><div align="center">
<input type="button" value="Abstimmen" onClick="vote(a)">
</div></td>
</tr>
</table>
</form>
</body>
</html>
I just start learning javascript, so I try some easy functions. But I do not know why this one (below) do not work. PLZ help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<script language="JavaScript1.3">
<!--
function vote(a)
{
var a = 0;
if(document.form1.bad==true)
{
a = 1;
alert(a);
}
else if(document.form1.bad==false)
{
a = 0;
alert(a);
}
//-->
</script>
</head>
<body bgcolor="#000033" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="form1">
<table width="80%" border="1" cellspacing="3" cellpadding="3">
<tr>
<td rowspan="2"><img src=http://www.webdeveloper.com/forum/archive/index.php/""></td>
<td><input name="bad" type="radio">Schlecht</td>
<td><input name="bad" type="radio">Gut</td>
<td><input name="bad" type="radio">Geil</td>
<td><div align="center">
<input type="button" value="Abstimmen" onClick="vote(a)">
</div></td>
</tr>
</table>
</form>
</body>
</html>