<div class="codetitle"> <span><a style="CURSOR: pointer" data="39406" class="copybut" id="copybut39406" onclick="doCopy('code39406')"><u>コードをコピー</u></a></span> コードは次のとおりです:</div> <div class="codebody" id="code39406"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><head> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>statistics test</title> <br><link type="text/css" rel="stylesheet" href="../css/statistics.css"/> <br><script src="../js/jquery.js"></script> <br><style type="text/css"> <br>.dropdiv{ <br>width: 177px; <br>height: 16px; <br>overflow: hidden; <br>float: left; <br>font-size: 13px; <br>font-family: "微软雅黑"; <br>position: relative; <br>padding: 5px; <br>} <br>.drpdown{ <br>width: 214px; <br>height: 24px; <br>font-size: 13px; <br>font-family:"微软雅黑"; <br>position: relative; <br>border:none; <br>padding-top:4px; <br>background:url(../images/dropdown.png) repeat-x; <br>} <br>.drpdown:active{ <br>width: 214px; <br>height: 24px; <br>font-size: 13px; <br>font-family:"微软雅黑"; <br>position: relative; <br>border:none; <br>padding-top:4px; <br>background:url(../images/dropdown.png) repeat-x; <br>} <br>.droparrow{ <br>width:27px; <br>height:27px; <br>background:url(../images/droparrow.png) no-repeat; <br>float:right; <br>} <br>.droparrow:hover{ <br>width:25px; <br>height:25px; <br>background:url(../images/droparrow.png) no-repeat; <br>float:right; <br>border:#F00 1px solid; <br>} <br>.dropmiandiv{ <br>margin-left:40px; <br>width:214px; <br>border: 2px solid #aaaaaa; <br>background:url(../images/dropdown.png) repeat-x; <br>height: 26px; <br>} <br>.chooseItems{ <br>border:#666 2px solid; <br>} <br>.chooseItems .chooseItem{ <br>font-size: 13px; <br>font-family: "微软雅黑"; <br>padding: 5px; <br>} <br>.chooseItems .chooseItem:hover{ <br>background:#09F; <br>} <br></style> <br></head> <br><br><body> <br><br><div class="dropmiandiv" quest ="select1"> <br><div id ="select1" displayMember="-1" valueMember ="请选择" class="dropdiv">请选择</div> <br><div class="droparrow"></div> <br></div> <br><div class="chooseItems" answer ="select1" style="display:none; position:absolute;"> <br><div class="chooseItem" displayMember="0" valueMember ="独立注册译员">独立注册译员</div> <br><div class="chooseItem" displayMember="1" valueMember ="供应商译员">供应商译员</div> <br><div class="chooseItem" displayMember="2" valueMember ="供应商">供应商</div> <br><div class="chooseItem" displayMember="3" valueMember ="代理商">代理商</div> <br></div> <br><br><div class="dropmiandiv" quest ="select2" style="position:absolute;top:200px;"> <br><div id ="select2" displayMember="-1" valueMember ="请选择" class="dropdiv">请选择</div> <br><div class="droparrow"></div> <br></div> <br><div class="chooseItems" answer ="select2" style="display:none; position:absolute;"> <br><div class="chooseItem" displayMember="0" valueMember ="独立注册译员">独立注册译员</div> <br><div class="chooseItem" displayMember="1" valueMember ="供应商译员">供应商译员</div> <br><div class="chooseItem" displayMember="2" valueMember ="供应商">供应商</div> <br><div class="chooseItem" displayMember="3" valueMember ="代理商">代理商</div> <br></div> <br><br></body> <br><br></html> <br><script type="text/javascript"> <br>$(".droparrow").click(function(e){ <br>var Quest = $(this).parent(); <br>var Questwidth = parseInt(quest.width()); <br>var クエスト高さ = クエスト.高さ(); <br>var left = クエスト.オフセット().left; <br>var トップ = parseInt(quest.offset().top) parseInt(questheight) 4; attrs = Quest.attr("quest"); <br>var selectsd = $('.chooseItems[answer=' attrs ']'); <br>var selectsdHeight = selectsd.height(); top selectsdHeight)>$(window).height()){ <br>top = top - selectsdHeight - Questheight-7; <br>} <br>if($(selectsd).is(":visible")) { <br>$(selectsd).hide(); <br>}else{ <br>$(selectsd).css({"left":left "px","top":top "px","width ":questwidth "px"}).show(); <br>} <br>}); <br>$(".dropdiv").click(function(e){ <br>var Quest = $(this).parent(); <br>var Questwidth = parseInt(quest.width()); <br>var クエスト高さ = クエスト.高さ(); <br>var left = クエスト.オフセット().left; <br>var トップ = parseInt(quest.offset().top) parseInt(questheight) 4; attrs = Quest.attr("quest"); <br>var selectsd = $('.chooseItems[answer=' attrs ']'); <br>var selectsdHeight = selectsd.height(); top selectsdHeight)>$(window).height()){ <br>top = top - selectsdHeight - Questheight-7; <br>} <br>if($(selectsd).is(":visible")) { <br>$(selectsd).hide(); <br>}else{ <br>$(selectsd).css({"left":left "px","top":top "px","width ":questwidth "px"}).show(); <br>} <br>}); <br>$(".chooseItem").click(function(e){ <br>var divhtml = $(this); <br>var displayMember,valueMember; <br>displayMember = divhtml.attr("displayMember") ; <br>valueMember = divhtml.attr("valueMember"); <br>var attrs =$(this).parent().attr("answer"); ; <br>var olddisplayMember,oldvalueMember; <br>olddisplayMember =parent.attr("valueMember"); >parent.attr("displayMember",displayMember); <br>parent.html(valueMember); <br> 🎜><br>$(this).parent().hide() <br>}); <br>$(".dropdiv").change(function(e){ <br>alert($(this).attr("valueMember")); <br>}); <br>$(".dropmiandiv").mouseleave(function(e){ <br>var Quest = $(this).attr("quest"); <br>$('.chooseItems[answer=' Quest ' ]').hide()<br>}); <br>$(".chooseItems").mouseenter(function(e){ <br>$(this).show(); <br>}); <br>$(".chooseItems").mouseleave(function(e){ <br>$(this).hide(); <br>}); <br></script> <br><br> </div>