请看我的Sample Fiddle...
我希望 JavaScript 警报以 jQuery UI 对话框的形式弹出,因为我想对其进行样式设置。感谢@asifrc的一些帮助,我得到了这个工作。
现在,我正在尝试设置该对话框的样式。
这就是我的 HTML 中的警报框...
<div id="pellalert"></div>
<div class="search-pell">
<form id="pellform">
<input type="text" value="Enter 13-14 PELL Score" class="search-input-bg-pell" id="pellscore" />
</form>
</div>
我在这里唯一能做的就是在整个对话框中应用内联样式,就像这样......
<div id="pellalert" style="font-size: 18px;"></div>
...但是这会设计整个盒子的样式,而不仅仅是我想要的样式。我如何制作<h1>
,<h2>
等,或<br />
在线条之间添加多个等等......有没有一种整体方法来设置这个样式?
这就是我设置警报脚本的方式,但我看不到如何在此处添加样式...
/*
Pell Alert
*/
//Set content to old alert content
var content = 'Based on the 2013-2014 EFC you entered ('+efc+'), you may receive...'
+' \n'
+' \n'
+' \n'
+' \n-Tuition of 36 credits: $14,472'
+' \n'
+' \n-Direct Loan maximum for a Freshman* student: $9,405**'
+' \n_________________________________________________________'
+' \n-Potential PELL Grant Award: $'+pell+'.'
+' \n_________________________________________________________'
+' \n-Your estimated total out of pocket payment: $'+estpay+'.'
+' \n_________________________________________________________'
+' \n-Potential Student Success Grant: $'+ssg+'.'
+' \n_________________________________________________________'
+' \n-Your estimated monthly out of pocket payment: $'+monthpay+'.'
+' \n...'
//Replace newlines with <br> (since it's now html)
content = content.replace('\n', '<br>');
//Set innerHTML of dialog, and then show the dialog
$('#pellalert').html(content).dialog('open');
}