How to create and apply CSS to javascript Alert

后端 未结 5 475
日久生厌
日久生厌 2020-12-10 14:47

Please tell me, how to apply CSS on javascript Alert. Thanks

相关标签:
5条回答
  • 2020-12-10 15:16

    You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look.

    In general, you shouldn't be using alert boxes because they are annoying and they block the entire browser.* You could always create a fake alert box with JavaScript that achieves the same effect. You could then style it however you want with normal CSS. If you use jQuery, there's SimpleModal (demos).

    * Modern browsers tend to only block the window that spawned the alert, but they're still annoying and you still shouldn't use them. :)

    0 讨论(0)
  • 2020-12-10 15:18

    You can use the sweet alert library of js

    official website

    github

    You can also customize the alerts with simple CSS.

    0 讨论(0)
  • 2020-12-10 15:24

    No you can't do that. I would suggest you either let it be, or use a modal window. You can also try using modal/dialog plugins e.g. http://docs.jquery.com/UI/Dialog

    0 讨论(0)
  • 2020-12-10 15:28

    you might want to check jConfirm (jQuery plugin)

    http://abeautifulsite.net/2008/12/jquery-alert-dialogs/

    0 讨论(0)
  • 2020-12-10 15:29

    It is not possible, or else people will use it to phish.

    0 讨论(0)
提交回复
热议问题