简体   繁体   English

vbscript MsgBox()的Javascript等效函数

[英]Javascript equivalent function for vbscript MsgBox()

I need to convert following function to javascript, 我需要将以下函数转换为javascript,

MsgBox("Are you a programmer?",0,"Please answer")

I think I can use confirm("Are you a programmer?") 我想我可以使用confirm("Are you a programmer?")

but I want to know how to add button order there ? 但我想知道如何在此处添加按钮顺序?

Javascript does not have the custimizability that vbscript does with this function. Javascript不具有vbscript使用此功能的可定制性。 And yes, it is confirm(). 是的,它是confirm()。 For example, 例如,

var choice=confirm("pick a button");
if(choice) alert("you picked ok");
else alert("you picked cancel")

You cannot control what the buttons say like in vbscript. 您无法控制按钮在vbscript中的显示方式。

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

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