Solved

javascript alert message box

Posted on 2011-03-20
11
801 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now