代碼如下:<script language="javascript">function goreg(){location.replace("reg.html");}function choice(){var a = document.getElementsByName("sx");if(a[0].checked){return 0;}if(a[1].checked){return 1;}if(a[2].checked){return 2;}}function returnChoice(){var a = choice();if(a == 0){location.replace("A.html");}if(a == 1){location.replace("B.html");}if(a == 2){location.replace("C.html");}}</script></head><body bgcolor="#999933"><h3>歡迎使用網上投稿系統</h3><form name="mf1" action="onSubmit = returnChoice()" method="post"><table align="center" class="t1" border="1"><tr><td>用戶名:</td><td><input type="text" name="user" size="14" /></td></tr><tr><td>密碼:</td><td ><input type="password" name="pwd" size="14"/></td></tr><tr><td><input type="radio" name="sx" onClick="choice()"/>作者</td><td><input type="radio" name="sx" onClick="choice()" />審稿員</td><td><input type="radio" name="sx" onClick="choice()" />管理員</td></tr><tr align="center"><td colspan="2"><input type="submit" name="dl" value="登錄"/></td></tr><tr align="center"><td colspan="2"><hr color="#FF3300">還沒賬號?趕快去申請一個吧</td></tr><tr align="center"><td colspan="2"><input type="button" name="b1" value="注冊" onClick="goreg()"/></td></tr></table></form>但是發現action中不能調用函數,該怎么辦。點選radio是能返回值的,問題是該怎么通過返回的值來進入不同的頁面呢? 不要把登陸的類型改成button,還要求是submit 類型。能寫一下具體函數里面怎么提交表單中的值嗎? 要能達到我的目的就行。
2 回答

慕哥6287543
TA貢獻1831條經驗 獲得超10個贊
javascript:onSubmit = returnChoice()
寫成這樣試試
API:
Syntax
HTML <ELEMENT ACTION = sURL... >
Scripting [ sURL = ] object.action
Possible Values
sURL String that specifies or receives the URL to use. If a relative path is specified, the base URL of the document is assumed.
The property is read/write. The property has no default value.
DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties
添加回答
舉報
0/150
提交
取消