我如何改变JS警告文本的字体

本文关键字:警告 JS 文本 字体 改变 何改变 | 更新日期: 2023-09-27 18:01:54

这可能听起来很愚蠢,但让我解释一下,我有这个ScriptManager.RegisterStartupScript,它确实调用一个JS方法显示一个弹出窗口,我想改变文本的font-family弹出,我该怎么做?

下面是我的代码:
ScriptManager.RegisterStartupScript(Page, typeof(Page),
"custom_alert", "swal({title: 'Alart',text: 'Please take a long look at the text, and try again',type: 'error',confirmButtonText: 'Okay'})",
true);

我如何改变JS警告文本的字体

你有没有试过把你的字体改变在text属性本身?我通过查看SweetAlert网页上的示例构建了这个(尚未经过测试!):

ScriptManager.RegisterStartupScript(Page, typeof(Page),
       "custom_alert", 
       "swal({
          title: 'Alert', 
          text: '<span style="font-family:verdana">Please take a long look at the text, and try again</span>',
          type: 'error',
          confirmButtonText: 'Okay'})",
       true);

另外,我想标题应该是说"警报"而不是"警报"。:)

从网页上看,好像你可以将自定义样式表与你的警报关联起来,这样你就可以让所有的警报看起来一致。(您也可以修改它附带的样式表,但我不建议这么做。如果允许的话,使用一个单独的自定义样式表