The most famous example is kingdoms and Tai ge to assign attribute values to the new generals role.
Next, use JavaScript to do such a function, by the way the link in the page underline to hide out.
Let's see what better ideas to optimize, everyone.
Here's the code:
The first is test.html:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<script language= "JavaScript" src= "Util.js" type= "Text/javascript" ></script>
<link rel= "stylesheet" href= "Link.css" type= "Text/css" >
</HEAD>
<body >
<form name= "Register1form" method= "POST" >
<table>
<tr>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "font1" ><div align= "right" >username</ Div></td>
<TD height= bordercolor= "#FFFFFF" bgcolor= "#D0E8FF" class= "Font1" > <div align= "Center" >
<input name= "username" type= "text" size= "" Maxlength= "Ten" value= "1" >
</div></td>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "Bg2" >
<div align= "center" ><font color= "#FF0000" ><font color= "#FF0000" ><font face= "black Body" ><a href= "" Onclick= "Javascript:add (Register1form); return false;" class= "A" >+</a></font></font></ font></div& gt;</td>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "Bg2" >
<div align= "center" ><font color= "#FF0000" ><font color= "#FF0000" ><font face= "black Body" ><a href= "" Onclick= "javascript:subtration (Register1form); return false;" class= "A" >-</a></font></font ></font></div& gt;</td>
</tr>
<tr>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "font1" ><div align= "right" >meili</div ></td>
<TD height= bordercolor= "#FFFFFF" bgcolor= "#D0E8FF" class= "Font1" > <div align= "Center" >
<input name= "Meili" type= "text" size= "" Maxlength= "Ten" value= "1" >
</div></td>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "Bg2" >
<div align= "center" ><font color= "#FF0000" ><font color= "#FF0000" ><font face= "black Body" ><a href= "" Onclick= "JAVASCRIPT:ADD2 (Register1form); return false;" class= "A" >+</a></font></font></ font></div& gt;</td>
<TD height= "bordercolor=" "#FFFFFF" bgcolor= "#D0E8FF" class= "Bg2" >
<div align= "center" ><font color= "#FF0000" ><font color= "#FF0000" ><font face= "black Body" ><a href= "" Onclick= "Javascript:subtration2 (Register1form); return false;" class= "A" >-</a></font></font ></font></div& gt;</td>
</tr>
</table>
</form>
</body>
There are also LINK.CSS:
Copy Code code as follows:
. A
Text-transform:none;
Text-decoration:none;
}
. a:hover {
Text-decoration:underline
}
The last is util.js (this code is longer):
Copy Code code as follows:
var Flag=false;
function Add (formname) {
if (Formname.username.value = = "") {
Alert ("Please enter a positive integer");
Formname.username.focus ();
return false;
}
Flag = Checkscope (FormName);
if (Flag==false) {
return false;
}
if (parseint (formname.username.value) >0) {
Formname.username.value =parseint (formname.username.value) +1;
if (parseint (formname.username.value) +parseint (formname.meili.value) >10) {
Alert ("The sum of the integers entered must not be greater than 10");
Formname.username.value =10-parseint (Formname.meili.value);
return false;
}else
return true;
}else{
Alert ("The entered integer must be greater than 0");
Formname.username.value = 1;
return false;
}
}
function Subtration (formname) {
if (Formname.username.value = = "") {
Alert ("Please enter a positive integer");
Formname.username.focus ();
return false;
}
Flag = Checkscope (FormName);
if (Flag==false) {
return false;
}
if (parseint (formname.username.value) >1) {
Formname.username.value =parseint (Formname.username.value)-1;
if (parseint (formname.username.value) +parseint (formname.meili.value) >10) {
Alert ("The sum of the integers entered must not be greater than 10");
Formname.username.value =10-parseint (Formname.meili.value);
return false;
}else
return true;
}else if (parseint (formname.username.value) ==1) {
Alert ("is already the minimum value, can not be reduced again");
return false;
}else{
Alert ("The entered integer must be greater than 1");
Formname.username.value = 1;
return false;
}
}
function Add2 (formname) {
if (Formname.meili.value = = "") {
Alert ("Please enter a positive integer");
Formname.meili.focus ();
return false;
}
Flag = Checkscope (FormName);
if (Flag==false) {
return false;
}
if (parseint (formname.meili.value) >0) {
Formname.meili.value =parseint (formname.meili.value) +1;
if (parseint (formname.username.value) +parseint (formname.meili.value) >10) {
Alert ("The sum of the integers entered must not be greater than 10");
Formname.meili.value =10-parseint (Formname.username.value);
return false;
}else
return true;
}else{
Alert ("The entered integer must be greater than 0");
formname.meili.value=1;
return false;
}
}
function Subtration2 (formname) {
if (Formname.meili.value = = "") {
Alert ("Please enter a positive integer");
Formname.meili.focus ();
return false;
}
Flag = Checkscope (FormName);
if (Flag==false) {
return false;
}
if (parseint (formname.meili.value) >1) {
Formname.meili.value =parseint (Formname.meili.value)-1;
if (parseint (formname.username.value) +parseint (formname.meili.value) >10) {
Alert ("The sum of the integers entered must not be greater than 10");
Formname.meili.value =10-parseint (Formname.username.value);
return false;
}else
return true;
}else if (parseint (formname.meili.value) ==1) {
Alert ("is already the minimum value, can not be reduced again");
return false;
}else{
Alert ("The entered integer must be greater than 1");
formname.meili.value=1;
return false;
}
}
function Checkscope (formname) {
if ((parseint (formname.username.value) >9) | | (parseint (Formname.username.value) <1)) {
Alert ("Username input number exceeds the allowable range 1-9");
formname.username.value=1;
Formname.username.focus ();
return false;
}
if ((parseint (formname.meili.value) >9) | | (parseint (Formname.meili.value) <1)) {
Alert ("Meili input number exceeds the allowable range 1-9");
formname.meili.value=1;
Formname.meili.focus ();
return false;
}
return true;
}
Three files in the same folder, and then try the effect, I certainly did not lie to you.