JS prompt box size

viivo

Diamond Member
May 4, 2002
3,345
32
91
I'm in class right now trying to finish my homework and I'm having some trouble. It's some busywork about creating a quiz using prompts then alerts with what the user typed in then the correct answer. However on the second prompt the question is too long and goes beyond the prompt box.

I tried searching but couldn't find a simple guide or sample of how to resize a prompt box.

This is what I have so far:


Anything simple that I could add to that to alter the size of the second prompt?

edit: man, attaching code here is really difficult. What happened to the
Code:
 tags that kept the indentions?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
The code tags don't work, and never have. Fortunately the board is moving to VBulletin fairly soon, and that has working code tags.

I don't believe you can resize the alert box, but if you insert new line characters to break the text it should size vertically to accomodate it.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,696
4,658
75
Yep, newlines work. You can paste this into your browser's address bar to see:

javascript:alert("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Hello! \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")

OT: Mark, how soon is fairly soon? Do you know something I don't?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Well, I've heard some rumblings in the staff lounge, but I can't really be more specific. I have some hope, let's leave it at that.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
I wrote a simple function to replace alerts and prompts and instead use jqueryUI's dialog box. It's cleaner, easier to work with and looks a lot nicer. Take you about 5 or 10 minutes to setup.