从子页面访问父页面input值的问题,高手们进来看看吧,谢谢了...

sayalove2012 2011-06-27 08:05:40
这是父页面的代码,采用innerHTML插入
var InfoHtml= "<table width='100%' border=0 cellSpacing=1 style='background:#9CD2FD' cellPadding=0><tr style='background:#EDF6FD'><td style='height:25px;width:60%;text-align:left;padding-left:5px;font-weight:bold;background:#9CD2FD;color:#ffffff;letter-spacing:2px'>插入"+TypeName+"</td>"+
"<td width='40%' align=center rowspan=3><div id='FileView' style='width:192px;height:200px;overflow:auto;text-align:center'><br><br>"+TypeName+"<br><br>预 览 区</div></td></tr>"+
"<tr style='background:#ffffff'><td style='height:150px;text-align:left;padding-left:15px;color:#666666' valign=top><div id='FileText'>请上传图片再插入</div><iframe frameborder=0 width=265 height=20 scrolling=no src='../upload.asp?action=pic'></iframe><br><b>URL地址:</b><br><input id='FileUrl' name='FileUrl' size='34' onblur='InfoFile(1)'><br><br><b>对齐方式</b>:<br><input type='radio' onclick='FileAlign=null' name='FA' checked>无 <input name='FA' type='radio' onclick=\"FileAlign='left'\">左对齐 <input type='radio' name='FA' onclick=\"FileAlign='center'\">居中对齐 <input name='FA' type='radio' onclick=\"FileAlign='right'\">右对齐</td></tr>"+
"<tr style='background:#ffffff'><td style='height:30px'><input value='确定' type='button' class='button' onclick='InfoFile(0)'> <input value='预览' type='button' class='button' onclick='InfoFile(1)'></td></tr></table>";

这是子页面的访问代码...

parent.form.FileUrl.value 提示找不到对像或为空,无法控制父页面的FileUrl中的值!!
...全文
147 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hch126163 2011-06-28
  • 打赏
  • 举报
回复
parent.document.getElementById
zell419 2011-06-27
  • 打赏
  • 举报
回复
window.opener.document.getElementById("FileUrl").value=InfoHtml;

你是怎么打开的 ?
挨踢直男 2011-06-27
  • 打赏
  • 举报
回复
parent.document.getElementById("FileUrl").value

87,989

社区成员

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

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