简体   繁体   English

JS提示的背景

[英]Background of JS Prompt

I am creating a 10-question quiz based on JS prompts for a website the real developer is busy programming. 我正在创建一个10个问题的测验,基于JS提示真正的开发人员忙于编程的网站。 That was easy enough to do, but the prompt box is not exactly aesthetically pleasing. 这很容易做到,但提示框并不完全美观。 Is there a way to incorporate a background image for the prompt box? 有没有办法为提示框合并背景图像?

Thanks 谢谢

IE: IE:
IE

Chrome: 铬:
铬

Firefox: 火狐:
火狐

Not only is it ugly, it is also not even close to consistent. 它不仅难看,而且甚至不一致。 Don't use prompt . 不要使用prompt

Use a real <form> instead. 请改用真正的<form>

If you're a more advanced developer, you can try making your own custom prompt . 如果您是更高级的开发人员,可以尝试制作自己的自定义prompt My own toolbox has a function called Dialog in which I can define text fields, drop-downs, and much much more. 我自己的工具箱有一个名为Dialog的函数,我可以在其中定义文本字段,下拉列表等等。 Here's a simple example of a prompt -like dialog: 这是一个类似prompt的对话框的简单示例:
PokéFarmQ

However, as I said, this is relatively advanced. 但是,正如我所说,这是相对先进的。 The function Dialog(...) {...} code in my source files is filled with features but over 200 lines long, and the dialog shown above is created with the code... 我的源文件中的function Dialog(...) {...}代码填充了超过200行的功能,上面显示的对话框是使用代码创建的...

Dialog("Hello!","Please answer the question:",
    {type:"input",value:"test",flex:3},
    // flex:3 results in it being three times bigger than the button
    {text:"Submit",onclick:function(inputs) {alert("You said "+inputs[0].value);}},
    {cancelable:true}
);

For the default prompt box no you cannot. 对于默认提示框,您不能。 Although there are many libraries that offers functionality that is the same of the prompt box: jQuery UI for example: http://jqueryui.com/dialog/ 虽然有许多库提供的功能与提示框相同:例如jQuery UI: http//jqueryui.com/dialog/

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

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