如何显示" #output"的内容结果?在同一页面?
<body>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<h1>Get Bing Search Feed</h1>
<input id="keyword" placeholder="Bing Keyword">
<button id="submit">Get Bing Search RSS Feed</button>
<a href="#" style="margin-top: 3rem; display: block;" id="output"></a>
<script type="text/javascript">
$('#submit').click(function() {
if ($('#keyword').val() != '') {
alert('For demonstration purposes only. Please do not point your RSS
reader to this server.');
var keyword = $('#keyword').val();
$('#output').html('').append('https://www.bing.com/search?q=' + keyword +
'&format=rss').attr('href', 'https://www.bing.com/search?q=' + keyword +
'&format=rss');
}
});
</script>
</body>
我在JS下面使用生成输出,但它似乎无法正常工作。请帮助。
<a href="#" onclick="document.getElementById('contents1').style.cssText =
''">output</a>
<div id="contents1" style="display:none;">
<h2>Result</h2>
<iframe src="output.html" width="500" height="400"></iframe>
</div>