• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 834
  • Last Modified:

Javascript: Changing Alert Message Icon(!)

How can you change the icon (!) in Javascript alert message? Alternatives?

I am sure this question has been debated over and over again and I think it can't be done. I want to know about the other alternatives discussed:
1. Custom Pop up box
2. Vbscript dialog box ( The application I am working upon is an Intranet app, and no one is allowed to install new browser :) ). So I am fine with VBscript.

It would be great if you guys let me know how I should go about doing either of the above mentioned alternatives.
Thank you so much,
Regards
dreamchaser23
0
dreamchaser23
Asked:
dreamchaser23
  • 5
  • 3
  • 2
  • +1
3 Solutions
 
samtran0331Commented:
A cool way to implement a custom popup would be to use the Ajax.Net modalpopup
http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx

Even though you said this is for an intranet (and IE only)...why not use something that you know will work in other browsers?...Personally, no matter what the circumstances...I stay away from anything that is browser-specific...
0
 
David H.H.LeeCommented:
Dear dreamchaser23,
Beside ajax modal pop up as suggested by samtran0331, you can solve it with javascript way.Check this previous PAQ, may give you the idea how to overcome mentioned.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21393249.html
0
 
dreamchaser23Author Commented:
Hey samtran,
yeah, I'd love to do some AJAX. :). Thanks for the URL
Thank you very much for your comment.
I'll definitely give it a shot and let you know happened.
Thanks again for you comment, EE Genius :)
Regards
dreamchaser
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
dreamchaser23Author Commented:
Hi x_com,
Thanks a lot for the url.
I searched but I wasn't able to find it.
Thanks again mate,
Regards
DreamChaser
0
 
samtran0331Commented:
There's a lot of info off of the main page, be sure to check it out...
http://ajax.asp.net/
0
 
David H.H.LeeCommented:
Dear dreamchaser23,
The link is work well here. The PAQ mentioned have recommend custom alert message which you can found it at http://slayeroffice.com/code/custom_alert/
0
 
dreamchaser23Author Commented:
Hi x_com,
I tried the code given in the slayer page:
But instead of displaying an alert box, I got the following message below my web page:

Oops!
This is a custom alert dialog that was created by over-riding the window.alert method.

Ok

Could you please let me know what has to be done.
Thanks,
Regards
dreamchaser
0
 
David H.H.LeeCommented:
Dear dreamchaser23,
Can you paste your existing current code that applied over here? Let see how i help. The complete fix had been mentioned at previous PAQ : http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21393249.html.
0
 
dreamchaser23Author Commented:
Hi X_com,
Thanks a lot for your concern and comment.
I just implemented the code present in the slayer page. I didn't make any changes to it.
I wish I could send you a snapshot of what I got, so that you can see what exactly goes wrong.
Please let me know if I am not clear.
Thank you,
Regards
DreamChaser
0
 
feliciayongCommented:
hi dreamchaser23

if u want to use vbscript...

1. create a file called customMsgBox.vbs... include the following code within:-

sub vbpopup(severity, errmsg)
      if severity = 1 then
            MsgBox errmsg, 64, "INFORMATION"
      elseif severity = 2 then
            MsgBox errmsg, 48, "WARNING"
      elseif severity = 3 then
            MsgBox errmsg, 16, "ERROR"
      end if
end sub

2. within <head> tags of your aspx page... include the following: -

<script language="vbscript" src="customMsgBox.vbs"></script>

chg the source of the file to the location where u placed the file... for eg... it may be "../script/customMsgBox.vbs"...

3. in the code-behind (.cs)... include the following method: -

private void ShowMessage(string strErrMsg, string strSeverity)
{
        System.Web.HttpBrowserCapabilities browser = Request.Browser;
      if (browser.VBScript) // if browser supports vbscript
      {
            if (!Page.IsStartupScriptRegistered("customAlert"))
            {

                  Page.RegisterStartupScript("customAlert", "<script language='vbscript'>vbpopup "+strSeverity+",\""+strErrMsg+"\"</script>");
            }
      }
}

4. To pop up the vb messagebox in code-behind, just use the code:-

PromptMessage(strMsg, strSeverity);

// where strMsg is the message u want to display
// and strSeverity is the severity of the error... "1" is information, "2" is warning, "3" is fatal



hope this will work for u... :)
0
 
feliciayongCommented:
sorry... one mistake....

under step 4...

"PromptMessage" should be "ShowMessage"

0
 
dreamchaser23Author Commented:
Hi Feliciayong.
I am really sorry for my delayed response. I apologize
I would love to use VBscript.
But I read my project specs and found that VBScript should be avoided as much as possible.
I really appreciate your code snippet and your explanation. very informative.
I am gonna split the points between you, x_com and samtran0331.
Thanks everyone for your help.
I once again apologize to everyone for my late response.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now