[新着] Webテンプレートを仮オープンしました
jpURL = new Array(
"セレクトボックスタイトル",//※一番先頭には、リンクを指定しない方が◎理由は下に記載したページで確認
"link1.htm",//リンク先1
"link2.htm",//リンク先2
"link3.htm"//リンク先3
);
function SelectNavi(){
var num;
num=document.navi.contents.selectedIndex;
if(num != 0) location.href=jpURL[num];
}
function FormWrite(){
document.write('<form name="navi">');
document.write('<select name="contents" onchange="SelectNavi()">');
document.write('<option>━━コンテンツ一覧━━</option>');
document.write('<option>HOME</option>');
document.write('<option>JavaScript入門</option>');
document.write('<option>さくさくHP作り</option>');
document.write('</select></form>');
}htmlコード↓<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis"> <title>セレクトボックスでのリンク</title> <script type="text/javascript" src="link.js"></script> </head> <body> <script type="text/javascript"> <!-- FormWrite(); // --> </script> </body> </html>↓こちらで詳しく説明してくれていますよ。