编辑:哎呀。谢谢大家!
我有以下代码:
<?php
echo"
<script type=\"text/javascript\">
function validation() {
var ok = 0;
";
for ($i=1; $i<=10; $i++)
{
echo" for (i=document.frmSurvey.q".$i.".length-1; i > -1; i--) {
if (document.frmSurvey.q".$i."[i].checked) {
v = i; i = -1;
}
}
if (i == -1) {
ok = 1;
document.getElementById(\"rq".$i."\").style.backgroundColor = '#901F39';
document.getElementById(\"rq".$i."\").style.color = '#FFF';
document.getElementById('mandall').style.backgroundColor = '#901F39';
document.getElementById('mandall').style.color = '#FFF';
return false;
}";
}
echo "if (ok == 0) document.frmSurvey.submit();
}
</script>";
?>
此代码位于<head>
我页面的部分中。但是,它只是将文本回显到页面上,而不是实际创建Javascript
.
我想我应该使用一个<header>
选项,但我完全迷路了。
欢迎任何和所有建议!
谢谢,
H。