这可能听起来很愚蠢,但让我解释一下,我有这个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);
你有没有试过把你的字体改变在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);
另外,我想标题应该是说"警报"而不是"警报"。:)
从网页上看,好像你可以将自定义样式表与你的警报关联起来,这样你就可以让所有的警报看起来一致。(您也可以修改它附带的样式表,但我不建议这么做。如果允许的话,使用一个单独的自定义样式表