我是Javascript的总noob。我想要的是有一个搜索表单,并且表单的输入应该改变网址,然后它会打开一个新的标签与新的网址。Javascript替换HTML字符
例如,当我输入'production'时,url将变成http://production-test.com/test/,然后一个新标签页将打开并显示新的url。
我知道这应该是在Javascript中,但我不知道它将如何能够返回新的url。
我有这个HTML到目前为止根本不工作。
<script language="javascript">
function change_url(result) {
#var result = document.getElementById().value;
var new_url = "http://" + result + "-test.com/test/';
# open new window with the new url
}
<form id="search-box" name="search_box" method="get"
action="http://variable-test.com/test/" target="_blank"">
<input id="search-text" type="text" autocomplete="off"
class="form-text-box no-focus" name="c" value="" aria-haspopup="true">
<input type="radio" id="rel" name="sort" value="1" onchange="saveType('rel');" /><span data-message="TypeOp1">Relevance</span><br />
<input id="search-button" type="submit" />
已有进展。感谢莫尔博士。但是现在我不知道如何传递参数?从Dr. Molle脚本... form.action =“.../test /?” +“new_paramters”。出于某种原因,放弃问号后的任何内容。 – Carmen 2012-04-01 04:49:29