EDIT: Oops. Thanks all!
I have the following code:
<?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>";
?>
This code is sitting within the <head>
section of my page. However, it is merely echoing the text onto the page and not actually creating the Javascript
.
I'm thinking I should be using a <header>
option but I'm completely lost.
Any and all advise welcome!
Thanks,
H.
<script type=\"text/javascript\"></script>
– ahren Nov 29 '12 at 22:51