简体   繁体   English

指定JavaScript警报框消息的字体大小

[英]Specify font size of javascript alert box message

I have to show the message on alert box with font size - 6. I have done like below. 我必须在警告框中显示带有字体大小-6的消息。我已完成如下操作。

     var str = "Formatting some text.";
     str = str.fontsize("6").fontcolor("#006400").bold();
     alert(str);

But the output get as 但是输出为
<b><font color="#006400"><font size="6">Formatting some text.</font></font></b> Please help to correct the issue <b><font color="#006400"><font size="6">Formatting some text.</font></font></b>请帮助解决此问题

I think No as per my knowledge as this is controlled by the browser 据我所知,我认为没有,因为这是由浏览器控制的

You would have to use a JavaScript based dialog windows alternative like jQuery UI Dialog . 您将不得不使用基于JavaScript的对话框窗口替代方法,例如jQuery UI Dialog

there is another alternative to jQuery UI Dialog box is sweetalert jQuery UI对话框还有另一种选择, sweetalert

It is possible to set bold text at alert() 可以在alert()处设置粗体文本

 alert("𝗙𝗼𝗿𝗺𝗮𝘁𝘁𝗶𝗻𝗴 𝘀𝗼𝗺𝗲 𝘁𝗲𝘅𝘁.") 

jsfiddle http://jsfiddle.net/7YgLB/10/ jsfiddle http://jsfiddle.net/7YgLB/10/

Use this code. 使用此代码。 It will help 我会帮你的

HTML HTML

<div id="Custom_Alert" title="Alert">
  <p style="font-size:6px">Formatting some text.</p>
</div>

JavaScript JavaScript的

$( function() {
  $( "#Custom_Alert" ).dialog();
} );

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

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