黑暗之魂3黑魔女套装:一个javascript的问题
<head>
<title>url title</title>
<script language="javascript">
function aswind()
{
aswind_url="http://"+window.document.aswind_form.aswind_test.value+"/";
window.open(aswind_url,"aswind_page",width='600' height='500'");
}
</script>
</head>
<body>
<form name="aswind_form" onsubmit="aswind();return false">
<h2>please enter the url<h2>
<input type="test" name="aswind_test" size=40 value="">
<input type=submit value="submit">
</form>
</body>
</html>
请懂的人帮我看看
window.open(aswind_url,"aswind_page",width='600' height='500'");
少了双引号了
改为:
window.open(aswind_url,"aswind_page","width='600' height='500'");
<input type=text id=url />
<input type=button value='go' onclick="gotoURL();" />
<script language=javascript>
function gotoURL(){
var url=document.getElementById("url").value;
if(url.toLowerCase().indexOf("http://")!=0)url="http://"+url;
window.open(url);
return;
}
</script>
所有源代码:
<htm1>
<body>
<input id="myUrl" type="test" size=40 value="">
<input type=submit value="submit" onClick="window.open('http://'+window.myUrl.value+'/');">
</body>
</html>
<head>
<title>url title</title>
<script language="javascript">
function aswind()
{
var aswind_url="http://"+document.aswind_form.aswind_test.value+"/";
window.location.href="http://www.mysee.com";
}
</script>
</head>
<body>
<form name="aswind_form" onsubmit="return false;">
<h2>please enter the url<h2>
<input type="test" name="aswind_test" size=40 value="">
<input type=submit value="submit" onclick="aswind();">
</form>
</body>
</html>
你也简单的来写
如果你是想要新开的窗口的话:
function aswind()
{
aswind_url="http://"+window.document.aswind_form.aswind_test.value+"/";
alert(aswind_url);
window.open(aswind_url,'aswind_page',width='600',height='500');
}
两个错误:一个是onsubmit那用错了,你的return false;将函数效果取消了,第二个地方是window.open处,
这里:
http://www.770880.net/bbs/dispbbs.asp?boardid=7&id=83&page=1
有关于这个函数详细的解释
http://www.tiantiansoft.com/bbs/dispbbs.asp?boardID=54&ID=117076&page=1