菜鸟问题,超级链接 onclick如何在一个窗口中打开新页面

toss2000 2009-10-23 10:59:43
我想在一个页面中的点击一个超级链接在同一窗口打开新页面以下是调用的js

function test1()
{
var loginname="<%=loginName%>";
var transpassword="<%=origPassword%>";
self.location.href="./judgeChangePassword.jsp?loginName="+loginname+"&origPassword="+encodeURIComponent(transpassword);
}

以下是html页面,我在<body>中加了
<base target="_self">

然后是连接
<div id="original" align="center" style="display:none"><span style=" text-align:center; font-size:12px;">密码仍然是初始化密码,请点击<a href="#" onclick="test1();">修改密码</a>,之后再登录!</span></div>

这个连接点击后,总是弹出新窗口,如何能不弹出新窗口呢?谢谢大家指点



...全文
513 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
toss2000 2009-10-23
  • 打赏
  • 举报
回复
up
toss2000 2009-10-23
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jol_boy 的回复:]
模态窗口的问题
[/Quote]
就是说如果是模态窗口就只能这样了是吗?
pdsnet 2009-10-23
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jol_boy 的回复:]
模态窗口的问题
[/Quote]
======================================
用户名密码这样放不好吧
sohighthesky 2009-10-23
  • 打赏
  • 举报
回复
这个加到<base target="_self"/>head中试试
jol_boy 2009-10-23
  • 打赏
  • 举报
回复
模态窗口的问题
BeenZ 2009-10-23
  • 打赏
  • 举报
回复
location.href应该没问题
toss2000 2009-10-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 adonis_net 的回复:]
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页 </title>
</head>
<body>
   
    <div>
    <a href="#" onclick="test()" >123 </a>
    </div>

</body>
</html>
<script>
function test()
{
    this.location.href="http://163.com";
}
</script>
[/Quote]

不行啊还是能打开新窗口,我这个页面是在一个模式窗口中的,是不是和这个有关?
adonis_net 2009-10-23
  • 打赏
  • 举报
回复
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>

<div>
<a href="#" onclick="test()" >123</a>
</div>

</body>
</html>
<script>
function test()
{
this.location.href="http://163.com";
}
</script>
BeenZ 2009-10-23
  • 打赏
  • 举报
回复
看了下,是模态窗口的问题,用下面方法看看..
父窗

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>无标题页</title>
<script language="javascript">
function openwin(url)
{
//打开模式窗口,注意模式窗口的样式
var arg=new Object();//传递进去的参数
arg.win=window;//把当前窗口的引用当参数传进去
var mydata=showModalDialog(url,arg,"dialogWidth:300px;dialogHeight:120px;center:yes;help:No;status:Yes;resizable:Yes;edge:sunken");
}
</script>
</head>
<body>
<input id="Button1" type="button" value="打开窗口" onclick='openwin("c.html")' />
</body>
</html>



模态窗 c.html

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language=javascript>
function ReturnWin()
{
var arg=window.dialogArguments;
arg.win.openwin("http://www.baidu.com");

}
</script>
</head>
<body>
<input id="Button1" type="button" value="跳转" onclick="ReturnWin()" />
</body>
</html>
toss2000 2009-10-23
  • 打赏
  • 举报
回复
再次up

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧