0
What's wrong in the code
4 Answers
+ 11
Here are some errors in your code.
HTML:
Line 7 : You can't use PHP in SoloLearn HTML+CSS+JS.
Line 7 : "method" is wrongly spelled.
JS:
Line 5 : "=" is wrong. "==" is correct.
+ 7
try changing your js code to this ~_~
function validate() {
var name="";
name=document.getElementsByName("txtname")[0].value;
if(name=="") {
alert("Name Should Contain Some value");
}else
if(name.length>9) {
alert("Name Should not Exceed 9 Charecters");
}else {
alert(name);
}
}
+ 6
thing about it a single mistake shows a lot of error
0
Try inserting your code in a window.inload function!
window.onload=function(){
//get the elements
}