2016-09-22 3 views
0

Hello everyone! I just want to ask, when I choose regular in my drop down. The link goes to the regular.html as well as the contractual. How can I do it? Thank you in advance. :)/オプションを選択し、そのオプションに指定されたリンクはまたここにregular.htmlのための私のコードです

を進めてまいります。 contractual.html

<html> 
<head> 
    <title>Drop down</title> 
</head> 
<body> 
    <h1>Contractual</h1> 
    <select> 
     <option href="regular.html">Regular</option> 
     <option href="contractual.html">Contractual</option> 
    </select> 
</body> 
</html> 
+1

参照してください、あなたがやりたい正確にどのようなhttp://stackoverflow.com/questions/10175445/load-page-on-selection-from-dropdown-form – Aswathy

+0

[リンク]? – Lakhan

答えて

0
<h1>Main Page</h1> 
    <select onchange="location = this.options[this.selectedIndex].value;"> 
     <option value="regular.html">Regular</option> 
     <option value="contractual.html">Contractual</option> 
    </select> 
+0

あなたの答えに感謝します。それは完全に働いた。ありがとう。 :) –

0

あなたはこれを試すことができます。

$('select').change(function(){ 
    var url = $('option:selected', this).attr('href'); 
    window.location.href = url; 
}); 
+0

コードの前にjquery ''をロードしてください。 –

+1

あなたの答えに感謝します。私はあなたの努力に感謝します。ありがとうございました。 :) –

+0

@FrancisVargas:なぜ返事が投票されるのですか? – Lakhan

関連する問題