[SOLVED] Validation not working in Mozilla
Posted: Thu May 13, 2004 5:17 pm
Why would this not be working in Mozilla? It works as expected in IE.
I don't even get the alert, and I just don't know what I'm doing wrong. I am not very good a javascript as you can tell.
Thanks for the help.
Code: Select all
//removed excess code for brevity
<style>
no_margin { margin: 0% 0% 0% 0% }
TABLE { border-color: #ffffff; border-style: none }
FONT { font-size: 8pt; color: #000000; font-family: arial,helvetica; }
INPUT { font-size: 8pt; color: #000000; font-family: arial,helvetica; }
SELECT { font-size: 8pt; color: #000000; font-family: arial,helvetica; }
BODY { font-size: 10pt; color: #000000; font-family: arial,helvetica; }
TD { font-size: 10pt; color: #000000; font-family: arial,helvetica; }
.error {
FONT-SIZE: 10pt; FONT-FAMILY: arial,helvetica; COLOR: #ee0000; TEXT-DECORATION: none;
}
<script type='text/javascript'>
function validate() {
if (questionnaire_1.answer1.value == '') {
document.getElementById('q1').className = 'error';
alert('Please fill in all the fields');
}
}
</script>
<form name="questionnaire_1" method="POST" >
<!-- Question #1 -->
<tr>
<td width=10 valign="top">
<b>1)</b>
</td>
<td align=left>
<span id="q1">Our records indicate that you have visited our website but did not place an order. Why?</span>
</td>
</tr>
<tr>
<tr>
<td>
</td>
<td>
<input type="button" name="submit" value="Submit" class="textinput" onclick="validate()">
</td>
</tr>Thanks for the help.