繁体   English   中英

如何将单选按钮添加到警报中?

[英]How can I add radiobuttons to a alert?

因此,我正在制作仅由警报,提示和变量驱动的游戏。 如何在提示或警报中放置单选按钮? 到目前为止的进展:

alert("Welcome to...\nGRANDMA SIMULATOR 2014!\nEnjoy your stay, sweetie pie. Make yourself at home.\nCopyright (c) CookieModding. All rights served.")
var age = prompt("How old are you?")
alert("Wow! You are " + age + " already? Just yesterday it feels like I was giving you your bottle. You grow up so fast. *gives hug*")
alert("Would you like some cookies?") //I need radiobuttons that say, "YES" or "NO"

使用alert()不可能做到这一点。 它是窗口对象的一种无法解释HTML标记的方法。 因此,尽管您可以在字符串中添加HTML,但不会将其呈现为html。

您需要在JavaScript中使用模式/对话框。

例如

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM