change alert message text color using javascript

后端 未结 4 549
小鲜肉
小鲜肉 2021-01-17 17:10

Am using the below script to change the color of the script but showing \'font color=\"red\">Hello world /font> like this.Is any possible way to change the alert text color.

4条回答
  •  青春惊慌失措
    2021-01-17 17:59

    No. alert() accepts a string and renders it using a native widget. There is no provision to style it.

    The closest you could get would be to modify the HTML document via the DOM to display the message instead of using an alert().

提交回复
热议问题