iFrame 中如何得到 父窗体中的一个 hidden 的值?父窗体 中:<from name='upload_form'>
<td align="left">
<input type='hidden' id='icon' name='icon' value='/image/default.gif'>
<iframe id="uploadFrame" name="uploadFrame" frameborder="0" scrolling="no" width="100%" height="153" src="upload.jsp"></iframe>
</td>
</form>iFrame 中有个图片,想得到 父窗体 中隐藏的 hidden 中的值
<from name='sub_form'>
<img id="headimg1" src="javascript:window.frames['upload_form'].document.getElementById('icon').value;" />
</form>...
<td align="left">
<input type='hidden' id='icon' name='icon' value='/image/default.gif'>
<iframe id="uploadFrame" name="uploadFrame" frameborder="0" scrolling="no" width="100%" height="153" src="upload.jsp"></iframe>
</td>
</form>iFrame 中有个图片,想得到 父窗体 中隐藏的 hidden 中的值
<from name='sub_form'>
<img id="headimg1" src="javascript:window.frames['upload_form'].document.getElementById('icon').value;" />
</form>...
<img id="headimg1" src="window.opener.parent.ducument.getElementById('icon')=a.jsp;" />
你用下面这个方法访问试试.
window.opener.document.upload_form.ico.value
在upload.jsp中:
window.parent.window.document.all.icon.value;
<from name='sub_form'>
<img id="headimg1" src="" />
</form>
<script>
document.getElementById('headimg1').src=window.parent.document.getElementById('icon').value;
</script>
...
这个肯定可以