我的代碼有什麼問題?使用javascript的框架
框架1
<script type="text/javascript">
var Clicks = 0 ;
function AddClick(){
Clicks = Clicks + 1;
document.getElementById('CountedClicks').innerHTML = Clicks ;
}
localStorage.setItem('Clicks');
</script>
</head>
Fish and Chips
<p align="right"> <input Type="BUTTON" VALUE="Order" onclick=" AddClick()"></p>
框架2
<head>
<script type="text/javascript">
var loc = "";
function go() {
window.location.href = loc;
}
function set_loc(theURL) {
loc = theURL;
}
window.onload = function() {
div = document.getElementById("CountedClicks");
div.innerHTML=localStorage.getItem('variable');
}
</script>
</head>
<body>
<div id="container" style="background-color:#8A4117;height:30%;width:98%;borde-radius:15px" >
You have ordered <span id="CountedClicks">0 </span> items.<br>
<p align="right"><input type=submit name="Submit" value="Checkout" onchange="set_loc('pay.html');" /></a></p>
</div>
我無法通過此從另一個幀計數點擊按鈕的數量。 *不是我自己的代碼
您究竟如何使用「AddClick」功能? – Pointy 2013-03-07 14:57:12
這是完全錯誤的寫。發佈所有代碼(即使使用HTML部分) – m93a 2013-03-07 15:00:45