【发布时间】:2011-08-30 22:47:51
【问题描述】:
我有一个带有 onClick 的提交按钮:
<div id="messageDiv">
<form>
<textarea name="message" rows="10" cols="20"></textarea></textarea>
<br /><br />
<input type="submit" value="Send" onClick="sendmail()">
<input type="reset" value="Reset" name='reset'>
</form>
</div>
然后我有我的发送邮件:
function sendmail()
{
window.location.href = "http://www.rainbowcode.net/index.php/profiles/mail?="+mailid;
window.location('http://www.rainbowcode.net/index.php/profiles/mail?='+mailid);
//return true;
}
mailid 是在另一个 JS 函数中设置的全局变量,它确实包含正确的值。 window.location怎么打不开我的页面?
如果我用 mailid 手动打开它,它可以正常工作..
【问题讨论】:
-
为什么要设置 location.href 并调用 location 作为函数?
-
window.location='http://stackoverflow.com/';不起作用..?
标签: javascript html