Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

javascript alert message box

Posted on 2011-03-20
11
Medium Priority
?
815 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 1500 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

618 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