我想点击这个时"<a href='#' onclick='LPC();'>
",就跳到baidu.com的页面.function LPC()
{
window.open ('http://www.baidu.com', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
但IE7报:"缺少对像",什么问题。谢谢.
",就跳到baidu.com的页面.function LPC()
{
window.open ('http://www.baidu.com', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
但IE7报:"缺少对像",什么问题。谢谢.
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function LPC()
{
window.open ('http://www.baidu.com', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
</script>
</head><body>
<a href='#' onclick='LPC();'> bbb</a>
</body>
</html>
我把你的代码拷过来。好像没问题嘛。我也是IE7...
height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no
不能有空格你把空格去掉试下
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm18.aspx.cs" Inherits="Maticsoft.Web.测试页面.WebForm18" %><!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 runat="server">
<title>我要去百度</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="http://baidu.com">百度一下</a>
</div>
</form>
</body>
</html>
{
strTopContentHTML +="<a href='#' onclick='LPC();'>" + latpRec("latp_latestfunctionname") + "</a> "; latpRec.Next();
}function LPC()
{
window.open ('../uploadfiles/upfile1.asp', 'newwindow', 'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
}
本来我是想在onclick事件中把这个加进去:window.open ('../uploadfiles/upfile1.asp', 'newwindow', 'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
但是程序可能对"和'符号有要求,所以我就想用一个事件去完成它了,但是当我用onclick 事件后,运行时报错,说"缺少对像",那有没有方法在这里直接做一个超链接给它,让它打开一个新的窗口??
strTopContentHTML +="<a href='#' onclick='window.open('http://baidu.com','newwindow',
'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, status=no')'>" + latpRec("latp_latestfunctionname") + "</a> ";这样好像不行,望高手赐教.谢谢
你知道是什么问题造成的吗?是你生成代码的问题,还是使用原有方法的问题。
strTopContentHTML +="<a href='#' onclick=\"window.open('http://baidu.com','newwindow',
'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, status=no')\">" + latpRec("latp_latestfunctionname") + "</a> ";
'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, status=no')'>" + latpRec("latp_latestfunctionname") + "</a> ";应该是"符号与'符号使用不当造成的.
'height=50, width=400, top=250,
left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, status=no')\">" + latpRec('latp_latestfunctionname') + "</a> ";
这样试试看
你的她是一个函数?如果是函数,这样写也是可以的啊latpRec('latp_latestfunctionname')。既然还有错。那就不知道是哪里的错了。
所以找到你点的时候的href就可以知道原因了。
去掉所有逗号后的空格:
'height=50,width=400,top=250,left=250,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no'
这个属性不能有任何空格的
<script>
function LPC()
{
window.open ('http://www.baidu.com', 'newwindow', 'height=50, width=400, top=250, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
return false;
}
</script><body>
<a href='#' onclick='return LPC();'> </a>
</body>