Solved

javascript alert message box

Posted on 2011-03-20
11
803 Views
Last Modified: 2012-05-11
Hello.  I am currently taking a JavaScript class and I have learned how to create alert box this week :)  I am curious that if there's a way to expand the number of characters allowed for these type of boxes for a long message to still show?
A friend of mine mentioned me about my other question of the positioning of alert box, he mentioned me that I need to use css and create modal popups and overlays.  Can I use the same method?

Thank you for your help in advance.
0
Comment
Question by:sabregirl
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 2

Accepted Solution

by:
michael_madsen earned 500 total points
ID: 35177213
The maximum lenth of characters in an alert message is 199 chars (at least for IE). I'm quite sure there is no way to extend that.

There is no way to position the alert box.

To create a modal dialog using CSS and layers, see this article: http://www.explainth.at/en/css/dlg.shtml
0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35177427
Yes you can use a messagebox in the form of a prompt. It is more flexible than javascripts "alert()" function. I think you can have up to 1024 characters in a prompt message so that would make things a bit easier for you don't you think.

MsgBox(prompt[,buttons][,title][,helpfile,context]);

See the example and explanation here.
http://www.w3schools.com/VBScript/func_msgbox.asp
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 35178281
Elvin: VBScript is not javascript. Please do not introduce IE-only VBScript to a student of JavaScript :)

--------------------------------------

Firefox 4 has by the way gotten scrollbars in its alert :)

jQuery UI Dialog is also an option, so is the buildt-in showModalDialog
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 20

Expert Comment

by:Mark Brady
ID: 35179125
I've got no idea what you meant by your comments.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 35179141
@Elvin: The asker is studying JavaScript and asks about a JavaScript issue.
You present him with a VBScript solution which is irrelevant since this is a JavaScript question.

From http://uopteamc.tripod.com/javavb.html

Comparison of JavaScript and VBScript

Similarities

Both languages are easy to learn and do not require any expensive development tools
   
Both can be used to enhance web pages
   
They run on client machines and can substitute CGI programs to reduce server loads
   
Both can abuse and run malicious scripts on clients' machines
   

Differences

JavaScript is the default scripting language for browsers but VBScript must be specified as the scripting language.
   
JavaScript has cross-platform support from all popular browsers while VBScript is supported MS IE only. VBScripters would thus lose a sizable audience.
   

0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35185683
mplungjan:

Fair comment by the asker posted this:


 I am curious that if there's a way to expand the number of characters allowed for these type of boxes for a long message to still show?

Now as I am from English decent that means he/she wants to know if there is a way to make larger messages in a messagebox. They did not ask that the answer MUST be in javascript. If that is the requirement for the question it should has been posted that way. I help people achieve a goal in any way I can. When people post in the PHP forum about how to achieve something like posting a form without refreshing, would you expect us experts to only supply the answer in Php code? I didn't think so. thanks for your comments but I think they are unwarranted in this case. I will excuse myself from this question and any more comments.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 35186678
No need to be offended, no offense intended. Just read the title, the tags and the first line of the question again. I could suggest to dowload webkit, change the size of the alert box and recompile a personalised browser. Valid suggestion but not relevant :)
0
 
LVL 2

Expert Comment

by:michael_madsen
ID: 35211216
sabregirl:

I believe your question has been answered. If you disagree, please comment.
0
 

Author Closing Comment

by:sabregirl
ID: 35220625
Thank you for everyone who left comments for me :)  I have learned something new...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 35220844
A split would have been nice... :)
0
 

Author Comment

by:sabregirl
ID: 35221013
Sorry mplungjan.  I will keep in mind next time!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question