我必须使用javascript函数显示重定向页面,增量为1。但是当我尝试这个时,我得到了 NaN Error 。谁能帮我解决问题。我在下面附上了我的来源。像这个 quiz.php?qusId=NaN。
<script type="text/javascript">
function handler(var1,quizId) {
alert(var1);
var id = parseInt(quizId);
window.location = "quiz.php?qusId="+parseInt(quid(id));
}
function quid(quzId){
if(quzId == 1){
return 1;
}else{
return quzId++;
}
}
</script>
</head>
<body>
<?php
$qusId=$_GET['qusId'];
?>
<form action="test.php" method="POST">
<?php
$result = select("SELECT * FROM questions WHERE question_id='$qusId'");
//$row = mysql_fetch_array($result);
$i=$_GET['qusId'];
while($row = mysql_fetch_array($result))
{
?>
<table width="581" height="299" border="1">
<tr>
<td>Union Assurance Questionnaire</td>
</tr>
<tr>
<td>
<?php
echo $i.'.' .$row['questions'];
$i++;
?>
</td>
</tr>
<tr>
<td>
<?php
$qId=$row['question_id'];
$result1=select("SELECT * FROM answers WHERE questionId='$qId' ORDER BY RAND()");
while($row1=mysql_fetch_array($result1)){
?>
<input type="radio" name="answers" value="<?php echo $row1['answers'];?>" onclick="handler('<?php echo $row1["feedback"]; ?>,<?php echo $qusId;?>')" /><?php echo $row1['answers']; ?><br/>
<?php
}
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?php
}
?>
</form>