登录 - 根据选择更改表单操作?
我在一个黑手党游戏中有这个脚本,我有 4 个世界/服务器。我有index.php,我想通过从选项中选择它来直接登录到其中一台服务器
我有此代码,我需要更改表单操作
<form action="/ro1/index.php?action=login" method="post">
<input id="user" name="user" class="text" type="text" value="Name"/><br>
<input name="clear" type="hidden" value="true" />
<input id="password" name="password" type="password" value="Pass"/>
<select id="server_select" class="server_select" name="server">
<option value="/ro1/index.php?action=login" selected >World 1</option>
<option value="/ro2/index.php?action=login">World 2</option>
<option value="/ro3/index.php?action=login">World 3</option>
<option value="/ro4/index.php?action=login">World 4</option>
</select>
<input type="image" src="graphic/index/login1.png" name="submit">
</form>
希望您明白我需要什么。
I have this script on a mafia game where I have 4 worlds/servers. I have index.php where I want to login directly to one of the servers by selecting it from a option
I have this code and I need to change form action
<form action="/ro1/index.php?action=login" method="post">
<input id="user" name="user" class="text" type="text" value="Name"/><br>
<input name="clear" type="hidden" value="true" />
<input id="password" name="password" type="password" value="Pass"/>
<select id="server_select" class="server_select" name="server">
<option value="/ro1/index.php?action=login" selected >World 1</option>
<option value="/ro2/index.php?action=login">World 2</option>
<option value="/ro3/index.php?action=login">World 3</option>
<option value="/ro4/index.php?action=login">World 4</option>
</select>
<input type="image" src="graphic/index/login1.png" name="submit">
</form>
Hope you understood what I need.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好在服务器上处理用户选择,并在那里执行重定向或根据需要处理操作。但如果你真的想在客户端处理它,你应该使用 javascript。包含 jQuery 库后,以下内容应该可以工作:
更具体地说,将以下代码添加到 html 文件的 head 部分。
Its probably best to handle the users selection on the server, and either perform a redirect there or handle the action as needed. But if you really wanted to handle it on the client side you should use javascript. The following should work after including the jQuery library:
To be more specific add the following code to the head section of your html file.