var txt = "<a href='javascript:;' onclick='javascript: openwindow('SubView.aspx','newwindow',602,500)' onMouseMove='seashowtip(this.tips,1,300)' onMouseOut='seashowtip(this.tips,0,300)' tips='"+b+"'><font color=\"#330066\">"+a[i][8]+a[i][3]+"</font></a>";map.addOverlay(new aboutText(point,txt));
我用javascript定义了一个变量,要打开一个新窗体.上面那样写怎么不对呢.根本弹不出来.总是提示语法错误.
最下面状态栏上显示的是http://localhost/Msg/A.aspx#
我用javascript定义了一个变量,要打开一个新窗体.上面那样写怎么不对呢.根本弹不出来.总是提示语法错误.
最下面状态栏上显示的是http://localhost/Msg/A.aspx#
function openwindow(url,name,iWidth,iHeight)
{
var url; //转向网页的地址;
var name; //网页名称,可为空;
var iWidth; //弹出窗口的宽度;
var iHeight; //弹出窗口的高度;
var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
<head>
<title>无标题页</title> <script src="../脚本/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("#Button1").bind("click",function(){
window.open("HTMLPage2.htm","222","width:300px;height:200px","");
})
})
</script>
</head>
<body>
<input id="Button1" type="button" value="click" />
</body>
</html>
function aboutText(point,txt)
{
//this.bounds_ = bounds;
this.point_ = point;
this.txt_ = txt;
}然后我定义了一个var txt = " <a href='javascript:;' onclick='javascript: openwindow('SubView.aspx','newwindow',602,500)' onMouseMove='seashowtip(this.tips,1,300)' onMouseOut='seashowtip(this.tips,0,300)' tips='"+b+"'> <font color=\"#330066\">"+a[i][8]+a[i][3]+" </font> </a>";
然后加载到地图
map.addOverlay(new aboutText(point,txt)); 不能用BUTTON
应该是onclick=\"javascript: openwindow('SubView.aspx','newwindow',602,500)\"
showModalDialog('report.do?method=allControl','','dialogWidth:580px;dialogHeight:360px;help:no;scroll:yes;status:no');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
果然是这个问题,解决了,但是有一个我传递了一个参数,怎么又提示传递不过去呢
var txt = "<a href='javascript:;' onclick=\"javascript: openwindow("SubView.aspx?sitenoname="+escape(a[i][3]),'newwindow',602,500)\" onMouseMove='seashowtip(this.tips,1,300)' onMouseOut='seashowtip(this.tips,0,300)' tips='"+b+"'><font color=\"#330066\">"+a[i][8]+a[i][3]+"</font></a>";
var txt = "<a href='javascript:;' onclick=\"javascript: openwindow('SubView.aspx?sitenoname="+escape(a[i][3])+"','newwindow',602,500)\" onMouseMove='seashowtip(this.tips,1,300)' onMouseOut='seashowtip(this.tips,0,300)' tips='"+b+"'><font color=\"#330066\">"+a[i][8]+a[i][3]+"</font></a>";