亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我想達到的目的:點選作者,審稿員,管理員之后 點登陸會進入不同的頁面。

我想達到的目的:點選作者,審稿員,管理員之后 點登陸會進入不同的頁面。

忽然笑 2022-07-14 11:11:19
代碼如下:<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


查看完整回答
反對 回復 2022-07-18
?
HUX布斯

TA貢獻1876條經驗 獲得超6個贊

都是 submit 了 你還這么提交干嗎?難道不允許函數里面提交的?

查看完整回答
反對 回復 2022-07-18
  • 2 回答
  • 0 關注
  • 165 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號