twQ
12-27-2009, 08:05 PM
Ok, I must be more tired then I think because I'm having the most simple problem yet I can't for the life of me figure out whats going on! Ok all I wanna do is check a box to see if it's blank...
JavaScript:
/*global window: false */
/*global document: false */
function submitConForm() {
var name=document.getElementById('name').value;
if (name==='') {
document.alert('You forgot to tell me your name!');
return false;
}
else {
document.alert('good to go');
}
}
HTML:
<input id="name" type="text" name="name" maxlength="20" class="txt">
<br>
<input type="submit" value="Send" class="btn" onClick="submitConForm();">
I removed the whole form thing because I was trying to simplify this and now it's so simple yet I STILL can't figure it out. I click to submit the function and...nothing happens? I KNOW I'm missing something so incredibly simple I'm gonna feel like an idiot, but I just wanna solve this.
Also incase the info helps, I ran it through JSLint, and W3C HTML checker thing. (Cause according to Firefox's spellcheck validator isn't a word, and there is no other word to mean that)
Thanks,
Tim
JavaScript:
/*global window: false */
/*global document: false */
function submitConForm() {
var name=document.getElementById('name').value;
if (name==='') {
document.alert('You forgot to tell me your name!');
return false;
}
else {
document.alert('good to go');
}
}
HTML:
<input id="name" type="text" name="name" maxlength="20" class="txt">
<br>
<input type="submit" value="Send" class="btn" onClick="submitConForm();">
I removed the whole form thing because I was trying to simplify this and now it's so simple yet I STILL can't figure it out. I click to submit the function and...nothing happens? I KNOW I'm missing something so incredibly simple I'm gonna feel like an idiot, but I just wanna solve this.
Also incase the info helps, I ran it through JSLint, and W3C HTML checker thing. (Cause according to Firefox's spellcheck validator isn't a word, and there is no other word to mean that)
Thanks,
Tim