この記事の例では、JSのテキストをクリックして選択した特定のコードを共有して、リファレンスのためにドロップダウンボックスに自動的に見つけます。特定のコンテンツは次のとおりです
<html> <head runat = "server"> <title> </title> <style type = "text/css"> #sitestat {width:97px;高さ:181px; } </style> </head> <body> <from> <スクリプト言語= javascript> function foo(){// var i = 3; var i = document.getElementById( "ds")。value; o = document.getElementById( "SiteStat"); for(c = 0; c <o.length; c ++){dy = o.options [c] .value.indexof(i)if(dy == 0)// if(o.options [c] .value == i){o.options [c] .selected = true;壊す; }}}} </script> <select name = "siteStat" multise = "multise" id = "sitestat"> <option値= "-1" selected> </option> <option値> <オプション値> <オプション値A </option> <option> <option value = "0" type = 'text' name = 'olala' id = 'ds'/> <input type = 'submit' name = 'sub' value = 'query display' onclick = "foo()"/> </body> </html>上記はこの記事に関するものであり、誰もがJavaScriptプログラミングを学ぶことが役立つことを願っています。