eskymo
03-05-2003, 06:25 AM
Hi there
i'm wanting to add a style to the text responses in the following script. Does anyone know how to do this? I can link the htnl page to the relevant stylesheet, but need to know how to apply the styles in the javascript.
heres the code:
<script type="text/javascript">
var recieved = location.search.substring(1);
var questionAndAnswer = recieved.split('&');
var total = 0;
for (var i = 0; i < questionAndAnswer.length; ++i) {
var answer = questionAndAnswer[i].split('=')[1];
total += parseInt(answer);
}
if (total < 20) { // adjust the values so they suit the possible scores that can be achieved from the quiz
document.write("oh dear, you only scored " + total);
} else if (total < 30) {
document.write("you scored " + total);
} else if (total < 40) {
document.write("you scored " + total);
} else {
document.write("congratulations you scored " + total);
}
</script>
cheers
e
i'm wanting to add a style to the text responses in the following script. Does anyone know how to do this? I can link the htnl page to the relevant stylesheet, but need to know how to apply the styles in the javascript.
heres the code:
<script type="text/javascript">
var recieved = location.search.substring(1);
var questionAndAnswer = recieved.split('&');
var total = 0;
for (var i = 0; i < questionAndAnswer.length; ++i) {
var answer = questionAndAnswer[i].split('=')[1];
total += parseInt(answer);
}
if (total < 20) { // adjust the values so they suit the possible scores that can be achieved from the quiz
document.write("oh dear, you only scored " + total);
} else if (total < 30) {
document.write("you scored " + total);
} else if (total < 40) {
document.write("you scored " + total);
} else {
document.write("congratulations you scored " + total);
}
</script>
cheers
e