Js solves the select drop-down problem, and jsselect drop-down
When the select drop-down box appears in the event mouseover, the select drop-down box is optional. solution:
Var o = e. relatedTarget | e. toElement; // determines the object to be moved to. If you move to ie, It is null and firefox is undefined ..
If (! O) return; // exit with option and do not hide
The complete code case is:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<Style type = "text/css">
* {Margin: 0; padding: 0; list-style: none; border: 0 ;}
. Pop_blue {position: absolute; cursor: pointer; padding: 10px ;}
. Pop_blue span {display: inline-block; width: 24px; height: 32px; background: url (../images/pop_blue.png) no-repeat ;}
. Map_xf. rud1 {width: 210px; position: absolute; border: 1px solid # ddd; display: none; background-color: # fff; padding: 17px 25px ;}
. Map_xf. rud1 li {margin: 0 0 8px ;}
. Map_xf. rud1 input,. map_xf. rud1 select {height: 22px ;}
</Style>
<Script type = "text/javascript" src = "jquery-1.9.1.min.js"> </script>
<Script type = "text/javascript">
$ (Function (){
$ ('. Pop_blue'). hover (
Function (){
$ (This). find ('. rud1'). show ();
((This).css ("z-index", "9999 ");
},
Function (e ){
Var o = e. relatedTarget | e. toElement; // determines the object to be moved to. If you move to ie, It is null and firefox is undefined ..
If (! O) return; // exit with option and do not hide
$ (This). find ('. rud1'). hide ();
((This).css ("z-index", "0 ");
}
)
})
</Script>
</Head>
<Body>
<Div style = "position: relative; width: 100px; height: 100px">
<Div class = "pop_blue" style = "top: 0px; left: 0;"> <span> move the cursor up </span> <I> </I>
<Div class = "rud1 font12" style = "top: 10px; left: 40px; display: none; padding: 50px; background: blue;">
<Ul>
<Li>
<Select class = "w100" id = "dan">
<Option value = "select unit" selected = ""> select a Unit </option>
<Option value = "select unit" selected = ""> select unit 1 </option>
<Option value = "select unit" selected = ""> select unit 2 </option>
<Option value = "select unit" selected = ""> select unit 3 </option>
<Option value = "select unit" selected = ""> select unit 4 </option>
</Select>
</Li>
</Ul>
</Div>
</Div>
</Div>
</Body>
</Html>
When you move the mouse up, select is not selected.
How to dynamically Delete the select drop-down list in js
<Html>
<Head>
<Title> </title>
</Head>
<Body>
<Script>
<! --
Var num; // used to identify the addition of several select statements.
Num = 1;
Var objPad;
Function addSelect (str)
{
ObjPad = document. getElementById ("pad ");
If (str = "del "){
Num = 1;
// ObjPad. removeAllChild ();
// ObjPad. innerHTML = "";
Var selectobj = document. getElementById ("pad"). getElementsByTagName ("select ");
Var I = selectobj. length;
If (I> 0)
{
ObjPad. removeChild (selectobj [I-1]);
ObjPad. removeChild (document. getElementById ("pad"). getElementsByTagName ("br") [I-1]);
}
}
Else
{
Var s = new Array ();
S = str. split (",")
Var sel = "<select name = 'ksbj" + num + "'>"
For (var I = 0; I <s. length; I ++)
{
Sel = sel + "<option value = '" + s [I] + "'>" + s [I] + "</option> ";
}
Sel = sel + "</select> <br/>"
ObjPad. innerHTML = objPad. innerHTML + sel;
Num = num + 1;
}
}
Function returnnum ()
{
Num1 = num-1
Var objPad = document. getElementById ("pad ");
Sel = "<input type = 'den den 'name = 'cs' value = '" + num1 + "'/>"
ObjPad. innerHTML = objPad. innerHTML + sel;
}
-->
</Script>
<Input type = "button" value = "add class" onClick = "addSelect ('1, 2, 3 ')"/>
<Input type = "butto... the remaining full text>
Js select selection problem, urgent
There is always a General Usage
Document. getElementById ("Select1"). value = "2 ";
// $ ("# Select1"). val ("2"); // jquery
<Select id = "Select1">
<Option value = "0"> x </option>
<Option value = "1" selected = "selected"> y </option>
<Option value = "2"> z </option>
</Select>