gpt4 book ai didi

Javascript:窗口.确认

转载 作者:行者123 更新时间:2023-11-28 04:59:28 28 4
gpt4 key购买 nike

我有一个功能:

function placeOrder(price, productList) {
var bulletinBoardItem = Number(productList.box1.value);
var stickersItem = Number(productList.box2.value);
var cutoutsItem = Number(productList.box3.value);
var trimmerItem = Number(productList.box4.value);
var resourceBooksItem = Number(productList.box5.value);
var price = new Array(5);
price[0] = 12;
price[1] = 1;
price[2] = 6;
price[3] = 3;
price[4] = 20;
var sumBB = bulletinBoardItem * price[0];
var sumStickers = stickersItem * price[1];
var sumCutouts = cutoutsItem * price[2];
var sumTrimmer = trimmerItem * price[3];
var sumRB = resourceBooksItem * price[4];
}

我有一个 window.confirm 框,我需要从中引用上述函数,但该函数中没有识别任何变量。我不明白我在这里做错了什么。

<input type="button" onClick="placeOrder()" value="Place Order">
<p id = "order"></p>
<script>
function placeOrder(quantity, price, productList) {
var r = confirm("You've ordered Bulletin Boards");
if (r) {
window.alert("Your order has been placed!!!")
} else {
window.alert("Your order has been canceled.");
}
document.getElementById("order").innerHTML = txt;
}

</script>

最佳答案

您正在使用未定义的txt:

document.getElementById("order").innerHTML = txt;

因此,尝试通过任何定义的字符串更改 txt,您的脚本将不会失败

关于Javascript:窗口.确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42264057/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com