Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 更改表单提交位置_Javascript_Php_Html - Fatal编程技术网

Javascript 更改表单提交位置

Javascript 更改表单提交位置,javascript,php,html,Javascript,Php,Html,我想更改表单提交的位置,因为我希望用户选择一个域,但当我提交表单时,它不起作用;当我提交表单时,没有下拉列表,它起作用 我的html: <form method="post" action="http://order.Freehostnoads.usa.cc/register2.php" id="form1"> <table> <tr><th style="text-align: left;">Free Subdomain<td><

我想更改表单提交的位置,因为我希望用户选择一个域,但当我提交表单时,它不起作用;当我提交表单时,没有下拉列表,它起作用

我的html:

<form method="post" action="http://order.Freehostnoads.usa.cc/register2.php" id="form1">
<table>
<tr><th style="text-align: left;">Free Subdomain<td><input type="text" name="username" size="30" maxlength="25" onkeyup="return ismaxlength(this)">
<select id="domain" size="1" onChange="javascript:chgAction()">
      <option value="http://order.freehostnoads.usa.cc/register2.php" selected="selected">.freehostnoads.usa.cc</option>
      <option value="http://order.3eehost.usa.cc/register2.php">.3eehost.usa.cc</option>
      <option value="http://order.3eehosting.usa.cc/register2.php">.3eehosting.usa.cc</option>
      <option value="http://order.3eehosting.igg.biz/register2.php">.3eehosting.igg.biz</option>
      <option value="http://order.3eehost.igg.biz/register2.php">.3eehost.igg.biz</option>
      <option value="http://order.3eehosting.flu.cc/register2.php">.3eehosting.flu.cc</option>
      <option value="http://order.3eehost.flu.cc/register2.php">.3eehost.flu.cc</option>
      <option value="http://order.3eehosting.nut.cc/register2.php">.3eehosting.nut.cc</option>
      <option value="http://order.3eehost.nut.cc/register2.php">.3eehost.nut.cc</option>
      <option value="http://order.fg.nut.cc/register2.php">.fg.nut.cc</option>
      <option value="http://order.hs.igg.biz/register2.php">.hs.igg.biz</option>
      <option value="http://order.pw.usa.cc/register2.php">.pw.usa.cc</option>
      </select>

自由子域
.freehostnoads.usa.cc
.3eehost.usa.cc
.3eehosting.usa.cc
.3eehosting.igg.biz
.3eehost.igg.biz
.3eehosting.flu.cc
.3eehost.flu.cc
.3eehosting.nut.cc
.3eehost.nut.cc
.fg.nut.cc
.hs.igg.biz
.pw.usa.cc
我的javascript:

<script>
function chgAction(){
    $('#form1').attr({'action':$('option:selected').attr('value')});
}
</script>

函数chgAction(){
$('form1').attr({'action':$('option:selected').attr('value'));
}
我想把这个放在一个网站上:

这个很有效(现在就在这里)。我将事件处理程序代码移出了标记

分配道具或属性是
.prop(“名称”、“值”)

也许你的免费站点正在删除你的链接。查看“检查”和控制台

$(函数(){
$(“#域”)。关于(“更改”,函数(){
$('#form1').prop('action',this.value);
});
}).change();//初始化

请选择
.freehostnoads.usa.cc
.3eehost.usa.cc
.3eehosting.usa.cc
.3eehosting.igg.biz
.3eehost.igg.biz
.3eehosting.flu.cc
.3eehost.flu.cc
.3eehosting.nut.cc
.3eehost.nut.cc
.fg.nut.cc
.hs.igg.biz
.pw.usa.cc

问题出在哪里?可能重复出现,然后您需要在控制台中查看。我的代码有效。检查元件并查看其是否改变动作。也许你的免费站点删除了所有其他地方的http链接OK它改变了操作但是奇怪的是注册页面不能与表单一起工作。我将设法解决这个问题。谢谢