[英]How do you go about refreshing content inside a bootstrap modal?
I have several random variables that are being input into a modal from JavaScript, these consist of either numbers or strings.我有几个从 JavaScript 输入到模态中的随机变量,它们由数字或字符串组成。
Is there a way to have a "refresh" button to re-run the scripts to pull new random variables into the modal without closing the modal and re-opening it.有没有办法让“刷新”按钮重新运行脚本以将新的随机变量拉入模态,而无需关闭模态并重新打开它。
Currently this is being input into the modal:目前,这正在被输入到模态中:
document.getElementById("randomScenario").addEventListener("click", Fullscenario);
function Fullscenario() {
document.getElementById("map-1-initialVelocity").innerHTML = window[velocities[randomUrban]].toFixed(2) + " kmh<sup>-1</sup>";
document.getElementById("map-1-ylPhase").innerHTML = window[ypUrban[randomYpUrban]].toFixed(1) + " s";
document.getElementById("map-1-rlPhase").innerHTML = window[ipUrban[randomIpUrban]].toFixed(1) + " s";
document.getElementById("map-1-rtRandom").innerHTML = window[driverReaction[randomRt]].toFixed(2) + " s";
document.getElementById("map-1-tireCondition").innerHTML = tires[tireCondition];
document.getElementById("map-1-weatherCondition").innerHTML = coldClimates[randomTireCold];
document.getElementById("map-1-carLength").innerHTML = carLength.toFixed(1);
}
If I have a refresh button on the modal, what syntax do I require at the HTML side and JavaScript side to refresh these scenarios without opening and closing the modal?如果我在模态上有一个刷新按钮,我需要在 HTML 端和 JavaScript 端使用什么语法来刷新这些场景而无需打开和关闭模态?
Thanks kindly for your help.非常感谢您的帮助。
模态 HTML 中的某处:
<button onclick="Fullscenario()">Refresh</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.