Javascript模式替换提示符?
最好的替换方法是什么Javascript模式替换提示符?,javascript,Javascript,最好的替换方法是什么 var value = prompt("Enter a URL", "http://www.google.com/"); 通过javascript模式(最好是纯javascript,如果不可能,则使用jquery) 谢谢 您需要更改调用它的方式,因此它现在遵循事件驱动编程风格,如下所示: function prompt(question, callback) { // here build a modal/form and after form submit:
var value = prompt("Enter a URL", "http://www.google.com/");
通过javascript模式(最好是纯javascript,如果不可能,则使用jquery)
谢谢 您需要更改调用它的方式,因此它现在遵循事件驱动编程风格,如下所示:
function prompt(question, callback) {
// here build a modal/form and after form submit:
callback(prompt_value);
}
prompt('Enter a URL:', function(result){
// do something with the result:
alert(result);
});
然后像这样使用它:
function prompt(question, callback) {
// here build a modal/form and after form submit:
callback(prompt_value);
}
prompt('Enter a URL:', function(result){
// do something with the result:
alert(result);
});
要获得更好的警报,您可以使用 对于纯JS模式,您可以检查哪个与任何css类兼容 ModaliseJS示例(根据您的设计更改类,只需保留一个
。关闭,。确认和。取消):
最好的办法?我猜答案是jQuery UI对话框。在纯JavaScript中,这样简单的信息没有太多意义。。。通常我个人不会显示提示。如果你不能在纯JavaScript中完成,你就不能在jQuery中完成。。。