新窗口问题!指教
一个datagrid里边的linkbutton,CommandName="xx",
然后在触发这个命令时
Response.Write("<script>");
Response.Write("window.open('yy.aspx');")'
Response.Write("<//script>");//单斜杆根本不行!!错误:常数有换行符
点击该linkbutton后,弹出消息框:语法错误,第一行缺少对象!
请问为什么??
另,测试用一个button,Onclick="ClickBtn".
将上述代码写到ClickBtn事件中,没有错误提示,但是页面并没有跳转,只是所有内容被清空!!!!!!!!!
高手回答啊,不然无法给分又要被扣信誉分了。
谢谢!
问题点数:100、回复次数:10Top
1 楼net_lover(【孟子E章】)回复于 2003-11-01 16:32:52 得分 10
Response.Write("</s"+"cript>");Top
2 楼net_lover(【孟子E章】)回复于 2003-11-01 16:34:02 得分 50
Response.Write("<script>");
Response.Write("window.open('yy.aspx');");
Response.Write("</"+"script>");Top
3 楼junmingl(峰高千仞)回复于 2003-11-01 16:34:27 得分 5
关注Top
4 楼nstorm(网の风)回复于 2003-11-01 16:35:13 得分 5
改成如下:
Response.Write("window.open(\'yy.aspx\');");
Top
5 楼Nicholasqpl(【快乐|我灌我灌我灌灌灌|快乐】)回复于 2003-11-01 16:39:40 得分 5
你在属性生成器了设置,linkbutton这个列设为超链接列.在URL字段里写你的表的ID字段.然后在URL格式字符串里写“你的页面.aspx?id={0}”就行了Top
6 楼rgbcn(奔向.net)回复于 2003-11-01 17:38:33 得分 10
windowAttribs = "width=" & width & "px," & _
"height=" & height & "px," & _
"left='+((screen.width -" & width & ") / 2)+'," & _
"top='+ (screen.height - " & height & ") / 2+'"
'Building the client script - window.open, with additional parameters
clientScript = "window.open('" & PagePath & "','" & windowName & "','" & windowAttribs & "');return false;"
'register the script to the clientside click event of 'opener' control
button.Attributes.Add("onClick", clientScript)
Top
7 楼WUNEN(吴灵)回复于 2003-11-01 17:42:11 得分 5
Response.Write("window.open(\'yy.aspx\');"Top
8 楼hillseok(山海经)回复于 2003-11-01 19:14:53 得分 5
第2个问题:要写为OnClick,另外,可以设断点看看是否执行了ClickBtn中的代码Top
9 楼hillseok(山海经)回复于 2003-11-01 19:17:55 得分 5
还有ClickBtn要声明为PublicTop
10 楼wflying(wflying)回复于 2003-11-01 19:35:55 得分 0
问题的解决惊人的奇怪。孟子E章胜出!为什么会这样?不知道,傻眼了。呵呵。给分结贴了。Nicholasqpl的方法没有办法尝试:因为我用文本写的。OnClick是因为笔误。感谢各位热心!!Top




