0
我這個簡單的格式化功能:無法獲取我的JavaScript函數?
function Forma(x, y): {
var handler = function(e) {
document.getElementById(x).innerHTML = Number(this.value * 100).toLocaleString() + " Centimes";
};
document.getElementById(y).onchange = handler;
document.getElementById(y).onkeyup = handler;
}
,並把它命名爲formatter.js
現在,我嘗試使用它的HTML頁面,在開始加載:
<script src="path/to/formatter.js"></script>
它加載它確定!但是當我把它放在:
<input id="price">
<script>
Forma("hhh", "price");
</script>
<h1 id="hhh" > </h1>
控制檯說Forma
沒有定義!
對不起,蟒蛇習慣;) – 2013-03-26 22:45:36
證實,它的工作,必須驗證僅11分鐘:( – 2013-03-26 22:46:20
@AbdelouahabPp高興以幫助 – 2013-03-26 22:47:37