1
我有一個JQuery,Javascript,HTML網站。我做了一個簡單的函數來打擊文本,如果它不等於0.javascript簡單功能刪除佈局
該函數似乎工作,但頁面中的其他內容都消失了。我只看到了我的文字。
productPrice應striked和salePrice不罷工...該功能的作品,但佈局變得混亂。幫幫我 ?
的文本顯示像這樣我的網頁上:
<label id="productPrice">Price</label>
<label id="salePrice">Sale Price</label>
繼承人的代碼,我可以根據需要提供更多。
功能
if (product.price != 0);
{
var salePrice = product.price;
document.write(salePrice.strike());
}
陣列
var catalog = {"products": [
{"thumbnail": '/pub/3/resources/ti/store/mobile/chrome.png',
"brand": "Google",
"name": "Chrome",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"rating": '5',
"sale_price": "0.00$",
"sale_desc": "",
"price": "0.00$"},
參數
$('#productPrice').html(product.price);
哦。這解釋了很多。切勿再次使用document.write()...謝謝。感謝幫助。 – JFFF