推奨:ASPは静的HTMページの基本コードを生成します公式リファレンスマニュアル、権威ある技術マニュアルダウンロード電子書籍チュートリアル分類次の点線のボックスは、mk.aspファイルの特定のコードです:----------------------------------------------------------------------- -------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------- -------------------------------
最近、フルスクリーンレイヤーを備えた多くのシミュレートされた画面ロックを使用していますが、この問題を解決するために、ドロップダウンリストボックスが常に表示されます、私はこのJSクラスを書いています。
効果プレビュー:
プログラムコード:
| 以下は引用されたコンテンツです。 <html> <head> <メタhttp-equiv = content-type content = text /html; <Title> JS Divは、フォーム要素の選択</title>をシミュレートします <スクリプト言語= javascript> seloptions = { 名前:セロプティオン、//これは配列の名前です データ:new array() } seloptions.data [0] = new Array(0、option0) seloptions.data [1] = new Array(1、option1) seloptions.data [2] = new Array(2、option2) seloptions.data [3] = new Array(3、option3) seloptions.data [4] = new Array(4、option4) seloptions.data [5] = new Array(5、option5) seloptions.data [6] = new Array(6、option6) seloptions.data [7] = new Array(7、option7) seloptions.data [8] = new Array(8、option8) seloptions.data [9] = new Array(9、option9) seloptions.data [10] = new Array(10、option10) seloptions.data [11] = new Array(11、option11) seloptions.data [12] = new Array(12、option12) seloptions.data [13] = new Array(13、option13) seloptions.data [14] = new Array(14、option14) seloptions.data [15] = new Array(15、option15) tmhselect = { //メイン関数 //パラメーターの意味:コンテナ、名前、データ[配列]、デフォルトアイテム、幅、アクション(目的関数にはパラメーターがありません) show:function(obj、selectname、dataobj、seloption、width、action){ var data = dataobj.data; var _obj = document.getElementById(obj); if(!_ obj || typeof(_obj)== undefined){return false;} var s1 = document.createelement(div); if(isnan(width)|| width ==){width = 150;} else if(width <26){width = 26;} s1.style.width = width; s1.onmouseleave = function(){tmhselect.hidden(selectname)}; var str =; //データがあるかどうかを判断します if(data.length> 0){ //データがあるときにデータオプションのリストを表示する str = <入力型= 'hidden' name = 'selectname' id = 'selectname' value = 'tmhselect.relv(seloption、data)'>; str = <div id = '_ a_ selectname' style = 'width:height:18px;'>; str = <div id = '_ v_ selectname' style = 'position:retary; float:float:left; left:2px; width:(width-22)px; height:18px; font-size:12px; hidden; line-高さ:18px; 'onclick =/tmhselect.showoptions(' SelectName '); str = <div style = 'position:recarty; float:right; right; right:0px; width:18px; height:18px; text-align:center; font-family:webdings; font-size:16px; anoverflow:hidden; background; -color:#cccccc; cursor:pointer!cursor:hand; 'onclick.showoptions(' SelectName ');/> 6 </div>; str = </div>; str = <div id = 'b_ selectname =' position:#fffff; X:hidden; anoverflow-y:auto; display:none:99999; '>; for(i = 0; i <data.length; i){ str = <div id = '_ s_ selectname' style = 'tmhselect.style(1、data [i] [0]、seloption)' onmouseover =/tmhselect.css(2、this、 'data [i] [0]' 、 'SelectName')/ onmouseout =/ tmhselect.css(1、this、 'data [i] [0]'、 'selectname')/ onclick =/ tmhselect.selected(this、 'data [i] [0]' 、dataobj.name、 'action')/> data [i] [1] </div>; } str = </div>; }それ以外{ //データがないときに空のフォームが表示されます str = <input type = 'hidden' name = 'selectname' id = 'selectname' value = 'seloption'>; str = <div id = '_ a_ selectname' style = 'width:height:18px;'>; str = <div id = '_ v_ selectname' style = 'position:retary; float:float:left; left:2px; width:(width-22)px; height:18px; font-size:12px; hidden; line-高さ:18px; str = <div style = 'position:recarty; float:right; right; right:0px; width:18px; height:18px; text-align:center; font-family:webdings; font-size:16px; anoverflow:hidden; background; -color:#cccccc; cursor:pointer!cursor:hand; 'onclick.showoptions(' SelectName ');/> 6 </div>; str = </div>; str = <div id = 'b_ selectname =' position:#fffff; Hidden; Overflow-y:auto; display:none; '> </div>; } s1.innerhtml = str; _obj.appendChild(S1); }、 //選択したアイテムの値を返します 値:function(n){return document.getElementbyid(n).value;}、 //選択したアイテムのテキストを返します テキスト:function(n){return document.getElementById(_V_ n).innertext;}、 選択:function(o、v、dn、action){ var d = dn.data; var n = o.id.replace(/(_ s _)/gi、) document.getElementById(n).value = v; document.getElementById(_V_N).innerhtml = tmhselect.restr(d、v); tmhselect.showoptions(n) for(var i = 0; i <document.getElementbyId(_b_n).childnodes.length; i){ document.getElementById(_B_N).ChildNodes [i] .style.csstext = tmhselect.style(1) } o.style.csstext = tmhselect.style(2); if(action!= && action!= null){ try {eval(action)} catch(e){} } }、 relv:function(v、d){ for(i = 0; i <d.length; i){ if(d [i] [0] == v){ vを返します。 } } if(v == null || v ==){ D [0] [0]を返します。 } }、 抑制:function(d、m){ for(i = 0; i <d.length; i){ if(d [i] [0] == m){ d [i] [1]を返します。 } } if(m == null || m ==){ d [0] [1]を返します。 } }、 高さ:function(l){var h; if(l> 10 || l <1)h = 10 * 15; ショータ:function(n){ var o = document.getElementByID(_B_N) if(o.style.display ==なし) o.style.display =; それ以外 o.style.display = none; _selectoptionselm = o; }、 非表示:function(n){ document.getElementByID(_B_N).style.display = none; }、 スタイル:function(m、v1、v2){ var cs =; if(v1 == v2 && v1!= && v1!= null){m = 2;} switch(m){ ケース1: cs = 15px:15px: 壊す; ケース2: CS = 15px:15px: 壊す; } CSを返します。 }、 CSS:function(s、obj、v、n){ var v1 = document.getElementById(n).Value; if(v == v1){ obj.style.csstext = tmhselect.style(2); 戻る; }それ以外{ obj.style.csstext = tmhselect.style(s) } } } function test(){ alert(tmhselect.value( 'test')); } </script> </head> <body> <div id = testdiv> < /div> <br /> <入力タイプ=ボタンname =ボタン値=テキストonclick = alert(tmhselect.text( 'test')) /> <入力型=ボタンname =ボタン値=表示オプション値onclick = alert(tmhselect.value( 'test')) /> <スクリプト言語= javascript> tmhselect.show(testdiv、test、seloptions、160、test()); </script> </body> </html> |
共有:ピンインへの漢字をASP、カスタム特別な言葉をサポートする今回は、使用していたブログプログラムを更新し、記事のタイトルのPinyinを使用するときにファイル名を使用しました。 GB2312の下でのみ正常である必要があり、ありません