I\'m generating a JavaScript alert with following code in C# .NET page:
Response.Write(\"
You can do a little adjustment to leave a blank line at the top.
Like this.
<script type="text/javascript" >
alert("USER NOTICE " +"\n"
+"\n"
+"New users are not allowed to work " +"\n"
+"with that feature.");
</script>
I had a similar issue when I wanted to change the box title and button title of the default confirm box. I have gone for the Jquery Ui dialog plugin http://jqueryui.com/dialog/#modal-confirmation
When I had the following:
function testConfirm() {
if (confirm("Are you sure you want to delete?")) {
//some stuff
}
}
I have changed it to:
function testConfirm() {
var $dialog = $('<div></div>')
.html("Are you sure you want to delete?")
.dialog({
resizable: false,
title: "Confirm Deletion",
modal: true,
buttons: {
Cancel: function() {
$(this).dialog("close");
},
"Delete": function() {
//some stuff
$(this).dialog("close");
}
}
});
$dialog.dialog('open');
}
Can be seen working here https://jsfiddle.net/5aua4wss/2/
Hope that helps.
Yes you can change it. if you call VBscript function within Javascript.
Here is simple example
<script>
function alert_confirm(){
customMsgBox("This is my title","how are you?",64,0,0,0);
}
</script>
<script language="VBScript">
Function customMsgBox(tit,mess,icon,buts,defs,mode)
butVal = icon + buts + defs + mode
customMsgBox= MsgBox(mess,butVal,tit)
End Function
</script>
<html>
<body>
<a href="javascript:alert_confirm()">Alert</a>
</body>
</html>
I Found this Sweetalert for customize header box javascript.
For example
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function(){
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
You can do this in IE:
<script language="VBScript">
Sub myAlert(title, content)
MsgBox content, 0, title
End Sub
</script>
<script type="text/javascript">
myAlert("My custom title", "Some content");
</script>
(Although, I really wish you couldn't.)