日期:2014-05-16  浏览次数:20341 次

如何获取iframe内的input的值?没有id,只有name
本帖最后由 gmyhbio 于 2013-06-10 01:25:46 编辑

<form action="test.php?action=delete" method="post" enctype="multipart/form-data" autocomplete="off" target="frame_profile" onsubmit="clearErrorInfo();">
<input type="hidden" name="site" value="1">
<input id="pmid" name="pmid" value="12106">
<button type="button" name="submit" value="true" onclick="setvalue();">test</button>
</form>
<iframe id="frame_profile" name="frame_profile" width="100%" height="900px"></iframe>
<script type="text/javascript">


iframe里有个表单,表单里有这个input了。
<input name="pmid" value="12106">

百度google了2个小时,没找到一个可用的。。

求大神们指教了。


还有我,给父页的表单里的input赋不了值是什么情况?
<script type="text/javascript">
function setvalue(){
$('#pmid').val = 'test';
}
setvalue();
</script>

------解决方案--------------------
看看这个是否对你有帮助 http://www.ok12.net/js/jq-get-set-iframe.html
------解决方案--------------------
引用:
看看这个是否对你有帮助 http://www.ok12.net/js/jq-get-set-iframe.html

这个可以,不过前提是iframe内嵌入的页面不能跨域
------解决方案--------------------
引用:
<form action="test.php?action=delete" method="post" enctype="multipart/form-data" autocomplete="off" target="frame_profile" onsubmit="clearErrorInfo();">
<input type="hidden" name="site" value="1">
<input id="pmid" name="pmid" value="12106">
<button type="button" name="submit" value="true" onclick="setvalue();">test</button>
</form>
<iframe id="frame_profile" name="frame_profile" width="100%" height="900px"></iframe>
<script type="text/javascript">


iframe里有个表单,表单里有这个input了。
<input name="pmid" value="12106">