<html>
<script type="text/javascript">
function showIFrame() {
var iframe = document.getElementById("output");
iframe.style.display="block";
}
</script>
<form method="get" name="search" id="search" target="carsearch">
<b>Enter Text</b><input type="text" id="pv2" name="pv2"/>
<input type="submit" value="Report Generation" class="submitBtn" id="SearchCarButton" onclick="showIFrame()"/>
<iframe id="output" style="border:1px solid;width:1000px;height:500px;" src="/00ON0000000FOHS?pv2=" name="carsearch">
</iframe>
</form>
</html>
我需要获取该输入值并将其保留在iframe Src="/00ON0000000FOHS?pv2=(value)"
中?
我怎么能这样做?
它必须取值并加载
答案 0 :(得分:1)
试试这个
<html>
<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
<script type="text/javascript">
function showIFrame()
{
var url='/00ON0000000FOHS?pv2=('+$('#pv2').val()+')';
$('#output').show();
$('#output').attr('src', url);
}
</script>
<form method="get" name="search" id="search" target="carsearch">
<b>Enter Text</b><input type="text" id="pv2" name="pv2"/>
<input type="submit" value="Report Generation" class="submitBtn" id="SearchCarButton" onclick="showIFrame()"/>
<iframe id="output" style="display:none;border:1px solid;width:1000px;height:500px;" src="/00ON0000000FOHS?pv2=" name="carsearch">
</iframe>
</form>
</html>
答案 1 :(得分:0)
是的,即使该网站来自其他域,也应该是可能的。
$('input:button[name=save]').click(function() {
var name = $('iframe[name=select_frame]').contents().find('#select_name').val();
});
答案 2 :(得分:0)
我建议您将data-src
属性添加到iframe
的JavaScript
function showIFrame() {
var myIframe = $('#output');
myIframe.attr('src', myIframe.attr('data-src') + $('#pv2').val());
myIframe.show();
}
HTML:
<iframe id="output" src="" data-src="/00ON0000000FOHS?pv2=" name="carsearch" style="display:none;border:1px solid;width:1000px;height:500px;" >
</iframe>