我更改了我的Iframe的源,但重新加載頁面,我找不到原因。 HTML:更改iframe重新加載的源頁面
<div id="fill">
<iframe id="frame" style="width: 88.97vw; height: 90vh" src="html/question1.html">
</iframe>
</div>
<form>
<input type="submit" value="question1" class="menuBut">
<input type="submit" value="question2" class="menuBut">
<input type="submit" value="question3" class="menuBut">
</form>
我的頁面是一個測驗,我要當按下一個按鈕的iframe改變的問題。 JQuery的:
var url;
function callMe() {
$(".menuBut").click(function() {
$("#frame").remove();
url = this.value;
$("#fill").append('<iframe id="frame" width="200px" height="700px" src="html/' + url + '.html"></iframe>');
});
}
$(document).ready(function() {
callMe();
});
源應該被改變到在網頁「的HTML/questionX.html」,其中X依賴於按下的按鈕。但它不適應iframe,而是刷新頁面。請支持。