First, Get text box/edit box/hide Field box
<script type= "Text/javascript" >
functionMyCheck (){
var checkstr= "Get content as follows: \ n";
if (document.Form1. Article author. Value! = "") {
checkstr+= "author name:" +document.Form1. Article author. value+ "\ n";
}
if (document.Form1. Article topic. Value! = "") {
checkstr+= "article topic:" +document.Form1. Article topic. value+ "\ n";
}
if (document.Form1. hide the domain. Value! = "") {
Checkstr+=document.Form1. hidden fields. Value;
}
if (checkstr! = "") {
alert (CHECKSTR);
return false;
}
else return
return true;
}
</script>
<form name= "Form1" onsubmit= "MyCheck ()">
<input name= "article author" type= "Text" class= "textbox" id= "article author" >
<input name= "article theme" type= "text" id= "article topic" class= "TextBox" >
<input name= "hidden domain" type= "hidden" id= "hidden Field" value= "article Added success!" >
It should be noted that the JS code I identified should be consistent with the code name in the HTML. Note that the value followed by JS Form1 should also be consistent with the name value in the HTML.
Second, get the value of the drop-down list
<script type= "Text/javascript" >
function MyCheck () {
var Val1,val2,val3;
Val1=document.form1.address.value;
Val2=document.form1.class1.value;
Val3=document.form1.huxing.value;
Alert ("Get drop-down list value: \ n lot:" +val1+ "\ n Listings Category:" +val2+ "\ n Listing Type:" +val3);
}
</script>
<form name= "Form1" onsubmit= "MyCheck ()" >
and (a) broadly similar, can be combined with application
<script type= "Text/javascript" >
function MyCheck () {
var checkstr= "Get content as follows: \ n";
var var1,var2,var3;
Var1=document.myform.project_cat1_id.value;
Var2=document.myform.project_cat2_id.value;
Var3=document.myform.project_cat3_id.value;
Var4=document.myform.score_reguired.value;
if (Document.myform.score_reguired.value! = "") {
Alert (checkstr+= "project:" +var1+ "\ n Category:" +var2+ "\ n Assessment content:" +var3+ "\ n Get the number of points:" +VAR4);
}
if (Document.myform.score_reguired.value = = "") {
Alert ("The number of points must not be empty!") ");
}
if (Document.form1. hide domain. Value! = "") {
Checkstr+=document.form1. Hidden fields. Value;
}
if (checkstr! = "") {
alert (CHECKSTR);
return false;
}
else return
return true;
}
</script>
JS Get text Box value