Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> </title>
<Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
// The following plug-ins are recommended to be stored in the js file for convenient calling.
// -------------- Begin ------------------
(Function ($ ){
// Shielding, suitable for a single element.
$. Fn. mask = function (){
Var divHtml = '<div class = "divMask" style = "position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; background: # fff; opacity: 0; filter: alpha (opacity = 0) "> </div> ';
$ (This). wrap ('<span style = "position: relative"> </span> ');
$ (This). parent (). append (divHtml );
$ (This). data ("mask", "true ");
}
// Unblocking
$. Fn. unmask = function (){
$ (This). parent (). find (". divMask"). remove ();
$ (This). unwrap ();
$ (This). data ("mask", "false ");
}
}) (JQuery );
// -------------- Plug-in end ------------------
// No disabled processing is performed, but a screen layer is added to it to make it unavailable.
// This makes it easier to handle other tasks.
Function changeA2 (obj ){
Var t = {'key': 'B', 'value': '2'}; // ing
If (obj. value = t. key ){
$ ("# A2"). val (t. value );
$ ("# A2"). mask ();
} Else {
$ ("# A2"). val ("");
$ ("# A2"). unmask ();
}
}
</Script>
</Head>
<Body>
<Select name = "A1" id = "A1" onchange = "changeA2 (this)">
<Option value = ""> -- select -- </option>
<Option value = "a"> a </option>
<Option value = "B"> B </option>
<Option value = "c"> c </option>
<Option value = "d"> d </option>
</Select>
<Select name = "A2" id = "A2">
<Option value = ""> -- select -- </option>
<Option value = "1"> 1 </option>
<Option value = "2"> 2 </option>
<Option value = "3"> 3 </option>
<Option value = "4"> 4 </option>
</Select>
</Body>
</Html>