<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
var i = 1;
window.onunload = function() {
debugger;
}
function Para() {
i = i + 1;
var Source = document.getElementById('P').src;
document.getElementById('P').src = Source.replace(i - 1, i);
}
</script>
</head>
<body>
<div><img alt="image" id="P" src="Images/Para/P-1.jpg"></div>
<div><img id="Q" src="Images/Q/P-1-Q-1.jpg" </div>
<div><img id="A" src="Images/A/P-1-Q-1-A-1.png"></div> <input id="Button1" type="button" value="Next Parigraph" onclick="Para()" /> <input id="Button2" type="button" value="Next Question" /> <input id="Button3" type="button" value="Next Answer" /> </body>
</html>
其實我想創建的HTML頁面可以加載圖像。但是這段代碼返回加載失敗的p-3.jpg。我不明白爲什麼會發生這種情況。首先在p-2.jpg之後加載P-1.jpg,點擊後第二次不加載並給出加載失敗。請幫助