javascript打开一个窗体

anya 2009-11-05 10:13:18
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#
...全文
90 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
hitlcyu19 2009-11-05
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 anya 的回复:]
引用 7 楼 guangboo 的回复:
问题在:onclick='javascript: openwindow('SubView.aspx','newwindow',602,500)',单引号的问题;
应该是onclick=\"javascript: openwindow('SubView.aspx','newwindow',602,500)\"


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
果然是这个问题,解决了,但是有一个我传递了一个参数,怎么又提示传递不过去呢
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>";

[/Quote]
openwindow(escape("SubView.aspx?sitenoname="+a[i][3]),...)
anya 2009-11-05
  • 打赏
  • 举报
回复
谢谢大家,问题解决了.
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>";
anya 2009-11-05
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 guangboo 的回复:]
问题在:onclick='javascript: openwindow('SubView.aspx','newwindow',602,500)',单引号的问题;
应该是onclick=\"javascript: openwindow('SubView.aspx','newwindow',602,500)\"
[/Quote]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
果然是这个问题,解决了,但是有一个我传递了一个参数,怎么又提示传递不过去呢
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>";
wangyuepeng 2009-11-05
  • 打赏
  • 举报
回复

showModalDialog('report.do?method=allControl','','dialogWidth:580px;dialogHeight:360px;help:no;scroll:yes;status:no');
夜雨~听风 2009-11-05
  • 打赏
  • 举报
回复
[Quote=引用楼主 anya 的回复:]
var txt = " <a href=[color=#0000FF]'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)); [/color]


我用javascript定义了一个变量,要打开一个新窗体.上面那样写怎么不对呢.根本弹不出来.总是提示语法错误.
最下面状态栏上显示的是http://localhost/Msg/A.aspx#
[/Quote]
href里面是什么意思啊,不专业面直接用#就好了。。再就是你的“”的问题了。。。这个道理好像与jsp中,innerHtml的用法一样。。。
sundotLei 2009-11-05
  • 打赏
  • 举报
回复
var txt = ' <a href="javascript:;" onclick="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));

Try.....
guangboo 2009-11-05
  • 打赏
  • 举报
回复
问题在:onclick='javascript: openwindow('SubView.aspx','newwindow',602,500)',单引号的问题;
应该是onclick=\"javascript: openwindow('SubView.aspx','newwindow',602,500)\"
spllot 2009-11-05
  • 打赏
  • 举报
回复
window.open("新开窗口的URL","新开窗口的句柄","定义新开窗口的各项属性");
anya 2009-11-05
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ws_hgo 的回复:]
HTML code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>无标题页</title><sc?-
[/Quote]


我不是Button,我是一个层,加载到地图上,
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
ws_hgo 2009-11-05
  • 打赏
  • 举报
回复
<!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>无标题页</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>
anya 2009-11-05
  • 打赏
  • 举报
回复
谢谢楼上,我的openwindow 是一个函数
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');
}
sundotLei 2009-11-05
  • 打赏
  • 举报
回复
var txt = ' <a href="javascript:;" onclick="window.open(\'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));


bing475879749 2009-11-05
  • 打赏
  • 举报
回复
openwindow 改成 window.open

87,994

社区成员

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

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