window.open参数问题

jacshan 2009-04-21 09:55:08

我有一个变量userid
var userid="userid"+id;
window.open('1.html',userid,'width=screen.width,height=screen.height');
我这里的id是通过ajax获得,现在调用window.open就报参数无效,请问该怎么解决?
...全文
627 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jasondct 2009-04-21
  • 打赏
  • 举报
回复
open的第一个参数是url,第二个是窗口的名字,第三个是窗口的特性
kangjial 2009-04-21
  • 打赏
  • 举报
回复
window.open('1.html',userid,'width=screen.width,height=screen.height');
这应该改成window.open('1.html?ID=userid,'width=screen.width,height=screen.height'); 吧
jacshan 2009-04-21
  • 打赏
  • 举报
回复
谢谢,我也记不清楚了,我改的是别人的代码,我就记得第二个参数我用变量不行
monexus 2009-04-21
  • 打赏
  • 举报
回复
open的第一个参数是url,第二个是窗口的名字,第三个是窗口的特性,LZ的错误在第三个参数(width和hidth的值必须是一个像素值)
jacshan 2009-04-21
  • 打赏
  • 举报
回复
这样啊,我明天去试试,如果直接var userid="userid";后面不加id到是可以的
yixianggao 2009-04-21
  • 打赏
  • 举报
回复
补充手册下载地址,L@_@K

DHTML 参考手册.rar
http://download.csdn.net/source/308913
yixianggao 2009-04-21
  • 打赏
  • 举报
回复
window.open() 的第二个参数不是用于传递变量滴

建议改为:
window.open('1.html?uid='+userid,null,'width='+screen.width+',height='+screen.height);

在 1.html 页面可以用 document.location.search; 获取问号后面滴字符串参数。

以下内容源自 DHTML 手册:

oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])
sName:
Optional. String that specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an a element._blank The sURL is loaded into a new, unnamed window.
_media The sURL is loaded into the HTML content area of the Media Bar. Available in Internet Explorer 6 or later.
_parent The sURL is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self.
_search Available in Internet Explorer 5 and later. The sURL is opened in the browser's search pane.
_self The current document is replaced with the specified sURL .
_top sURL replaces any framesets that may be loaded. If there are no framesets defined, this value acts as the value _self.


87,910

社区成员

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

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