<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title id="Title1" runat="server">..</title>
<script type="text/javascript">
function clickT(){
window.location.href='pages/client/addClient.jsp';
}
</script>
</head>
<body>
<input value="click" type="button" onclick="clickT();" />
</body>
</html>
当我点击按钮时,将会得到这样的结果:
The page cannot be displayed
The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings.
调试了好久,也不知道是什么原因,后来考虑到IE6下会把所有的标签自动都补全地址,于是写上了完整的路径
把
function clickT(){
window.location.href='www.g.cn';
}
修改为
function clickT(){
//我的项目名:crm11,在此可以不用加http://,绝对路径:只要 项目名/跳转的页面
window.location.href='/crm11/pages/client/addClient.jsp';
}
问题得以解决,最终代码如下:
代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title id="Title1" runat="server">..</title>
<script type="text/javascript">
function clickT(){
window.location.href='/crm11/pages/client/addClient.jsp';
}
</script>
</head>
<body>
<input value="click" type="button" onclick="clickT();" />
</body>
</html>
总结:IE6下window.location.href值必须写上完整的地址,不能使用相对地址。
补充一个问题:
IE6下用A标签做按钮的解决方案:
1、事件必须return false
<a href="javascript:void(0);" onclick="event();return false;"></a>
2、a标签的href属性设为一个锚点。
<a href="#" onclick="event();"></a>
相关推荐
window.location.href页面跳转的用法(区别于redirect)
详解js location.href和window.open的几种用法和区别.docx
一、location.href常见的几种形式 self.location.href;//当前页面打开URL页面 [removed].href;//当前页面打开URL页面 this.location.href;//当前页面打开URL页面 location.href;// 当前页面打开URL页面 parent....
如果D中js这样写 “[removed].href”、”location.href”:D页面跳转 “parent.location.href”:C页面跳转 “top.location.href”:A页面跳转 如果D页面中有form的话, <form>: form提交后D
javascript 打开页面window.location和window.open的区别.docx
NULL 博文链接:https://hugang357.iteye.com/blog/1833003
window.opener.location.href = window.opener.location.href 刷新以winodw.showModelDialog()方法打开的窗口 window.parent.dialogArguments.document.execCommand('Refresh'); 或 Response.Write("<script>...
IE11没有window.attachEvent方法处理方法,文档中有详细说明
javascript中window.confirm这个方法很好用,可以弹出一个确认对话框我们之所以弹出这个对话框,可能就是因为该操作很危险,所以要用户确认。但如果默认选择”确定”,则可能违背了这个原则。 另外,confirm对话框的...
对window.open进行封装, 使其更好用, 且更兼容, 很多人说window.open不兼容,其实不是, 因为不能直接执行, 必须通过用户手动触发才行;看代码: 代码如下 var openWindow = function(url, options) { var str = ""; ...
简单的说:几种location.href的区别 js实现网页被iframe框架功能 “[removed].href”、”location.href”、”self.location.href”是本页面跳转 “parent.location.href”是上一层页面跳转 “top.location.href”是...
document 表示的是一个文档对象,windows 表示一个窗口对象。... 发现,这两个的值不一样, document.URL : //www.jb51.net/ windows.location.href ://www.jb51.net/#server 所以,如果要用 fragment 进行
[removed].href是js中跳转功能,很多人在ie6中都会发现[removed].href不能跳转了,下面我给大家来介绍一下其原因与解决方法。 问题代码如下: 代码如下:点击会跳转</a> [removed] test = function(){ ...
除了IE6、IE7之外的所有浏览器都支持这个功能。 数据发送端 首先我们要做的是创建通信发起端,也就是数据源”source”。作为发起端,我们可以open一个新窗口,或创建一个iframe,往新窗口里发送数据,简单起见,我们...
Window.open ('page.html') 用于控制弹出新的窗口page.html,如果page.html不与主窗口在同一路径下,前面应写明路径,绝对路径(http://)和相对路径(../)均可。用单引号和双引号都可以,只是不要混用。 这一段代码...
针对window.showmodaldialog弹出窗体无刷新的详细使用
针对window.location.href在ie6下不能跳转问题详解
window.clearInterval与window.setInterval的用法.