10w火急,有的电脑出错

ck1148 2014-09-11 09:39:15
formatDate = window.dialogArguments.replace( /-/g,"/");
这句是什么意思?里面的参数什么意思?看不懂
下面是错误信息
Uncaught TypeError: Cannot read property 'replace' of undefined calendar1.htm:26

<html>
<head>
<title>日期选择</title>
</head>
<body topmargin="0" leftmargin="0" scroll="no">
<table border="0" cellpadding="0" cellspacing="0" width="22">
<tr>
<td>
<OBJECT id="cal" style="LEFT: 0px; WIDTH: 200px; TOP: 0px; HEIGHT: 160px" type="text/x-scriptlet" height="14" width="14" data="calendar2.htm"></OBJECT>
</td>
</tr>
</table>
<script LANGUAGE="JavaScript" FOR="cal" EVENT="onscriptletevent(name,eventdata)">
dateChange(eventdata);
</script>
<script language="JavaScript">
window.onload = initWindow;
function initWindow() {
var temp;
var re;
var formatDate;

temp = window.dialogArguments;

re = /-/g;
formatDate = temp.replace(re,"/");

window.returnValue = formatDate;

cal.setDate(formatDate);
}

function dateChange(sValue) {
window.returnValue = sValue;
window.close();
}

</script>
</body>
</html>
...全文
119 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
bichir 2014-09-11
  • 打赏
  • 举报
回复
window.dialogArguments是在模式化窗口中获取传过来的参数列表,他是一个数组类型。你不能temp.replace用一个循环来搞吧 比如 for(var i=0;i<temp.length;i++){ var formatDate = temp[i].replace("a","b"); }
似梦飞花 2014-09-11
  • 打赏
  • 举报
回复
http://lixun5201612.blog.163.com/blog/static/8960484020091243234684/

87,909

社区成员

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

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