I heard about jquery, but I have been amazed because the project is too busy to learn for a long time;
Recently, I am a little blank. In the following project, we need to use the "single region" and "check box" functions to spare time and sharpen the knife.
Jquery 1.3 api reference Chinese Version
Http://jquery-api-zh-cn.googlecode.com/svn/trunk/index.html
<SCRIPT src = "jquery-1.3.2.min.js"> </SCRIPT>
<Script language = "JavaScript">
$ (Document). Ready (function (){
VaR ul1_value = "";
VaR ul2_value = "";
$ ("# Ul1 li"). Click (function (){
$ (This). toggleclass ("checked ");
$ ("# Ul1 Li [class = 'checked']"). Each (function (){
Ul1_value = ul1_value + "," + $ (this). ATTR ("value ");
});
$ ("# Ul1_value"). Val (ul1_value );
Ul1_value = "";
});
$ ("# Ul2 li"). Click (function (){
$ (This). toggleclass ("checked ");
$ ("# Ul2 Li [value! = '"+ $ (This). ATTR (" value ") +"'] "). removeclass (" checked ");
If ($ (this). ATTR ("class") = "checked "){
Ul2_value = $ (this). ATTR ("value ");
}
$ ("# Ul2_value"). Val (ul2_value );
Ul2_value = "";
});
});
</SCRIPT>
<Style>
. Checked {
Background-color: # ff0000;
Font-weight: bold;
}
</Style>
Multiple selection box <input type = "text" id = "ul1_value"> <br/>
<Ul id = "ul1" value = "checkbox">
<Li value = "1" class = "checked"> Li1 </LI>
<Li value = "2"> li2 </LI>
<Li value = "3"> li3 </LI>
<Li value = "4"> LI4 </LI>
</Ul>
<Br/>
Single partition <input type = "text" id = "ul2_value"> <br/>
<Ul id = "ul2" value = "radio">
<Li value = "1" class = "checked"> Li1 </LI>
<Li value = "2"> li2 </LI>
<Li value = "3"> li3 </LI>
<Li value = "4"> LI4 </LI>
</Ul>
<Br/>