2012-11-08 107 views
-1

是否可以使用帶有單選按鈕的表單提交後鏈接到所選頁面?所以我選擇了第一個單選按鈕,點擊提交併獲取了url /angebote.html單選按鈕鏈接

Thx!

<form id="aktion"> 
      <div class="action-check"> 
      <input class="radio" type="radio" value="angebote.html" name="suche"> 
      <label for="suche">Ich suche ein Zimmer</label> 
      </div> 
      <div class="action-check"> 
      <input class="radio" type="radio" value="angebotseingabe.html" name="biete"> 
      <label for="biete">Ich biete ein Zimmer</label> 
      </div> 
      <div class="action-check"> 
      <input class="radio" type="radio" value="gesuchseingabe.html" name="gruenden"> 
      <label for="gruenden">Ich möchte eine WG gründen</label> 
     </div> 
      <div class="submit_container"> 
      <input class="submit" type="submit" value="Los geht's"> 
     </div> 
    </form> 

回答

0

您可以使用類似這樣的JavaScript。

<HTML> 
    <HEAD> 
     <SCRIPT language="javascript"> 
       function choiceprop(form3) { 
        var url = <!-- check the good case here --> 
        window.location = url; 
       } 
      </SCRIPT> 
    </HEAD> 
    <BODY> 
     <FORM NAME="formtest"> 
      <INPUT TYPE="radio" NAME="choice" VALUE="url1">name1<BR> 
      <INPUT TYPE="radio" NAME="choice" VALUE="url2">name2<BR> 
      <INPUT TYPE="radio" NAME="choice" VALUE="url3">name3<BR> 
      <INPUT TYPE="button"NAME="but" VALUE="Validate" onClick="choiceprop(formtest)"> 
     </FORM> 
    </BODY> 
</HTML> 
+0

這就像一個魅力:http://stackoverflow.com/questions/6741340/radio-button-to-open-pages –