Solved

javascript alert message box

Posted on 2011-03-20
11
808 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

730 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