编写一个网页,网页中包括表单文本框和按钮,在文本框中输入网站的地址后,单击按钮,将链接到输入的网站
<SCRIPT LANGUAGE="JavaScript">
function RedirectTo(url)
{
window.open(url);
}
</SCRIPT>
<FORM METHOD=POST ACTION="">
<INPUT TYPE="text" NAME="url" >
<INPUT TYPE="submit" onClick="RedirectTo(url.value)" value="打开网址">
</FORM>
function RedirectTo(url)
{
window.open(url);
}
</SCRIPT>
<FORM METHOD=POST ACTION="">
<INPUT TYPE="text" NAME="url" >
<INPUT TYPE="submit" onClick="RedirectTo(url.value)" value="打开网址">
</FORM>
温馨提示:答案为网友推荐,仅供参考
第1个回答 2009-05-06
<input id="urltxt">
<input type="button" onclick="javascript:window.open(document.getElementById('urltxt').value)" value="GO!">
<input type="button" onclick="javascript:window.open(document.getElementById('urltxt').value)" value="GO!">