> when they click "ok" another alert pops up with their personality
> description. The problem is,
> an alert box will only let me type so many words (like "You are outgoing").
> But, I want a
> pop-up where I can put a longer description. How do I do that?
You need to ensure your description is a valid JavaScript string.
Key things are:
- line breaks must be entered as \n
- apostrophes must be entered as \'
for example:
alert('line one\nline two\noingy\'boingy');
for long text, having everything on one line can be inconvenient, so
you can do this:
alert
('line one\n'
+'line two\n'
+'oingy\'boingy'
);
(note that the \n line breaks are still required)
If you want to get fancy and do formatting and stuff, you need to look
into DOM scripting for showing/hiding containers.
<div id="mypopup" style="display: block; position: absolute; left:
20%; width: 60%; top: 20%; height: 60%; background: white; border:
double 3px blue;">
<p>A HTML message that can contain <em>formatting</em> and <a
href="">links</a> and any other HTML code you like.</p>
<hr/>
<button onclick="document.getElementById('mypopup').style.display =
'none';">close popup</button>
</div>
....
document.getElementById('mypopup').style.display = 'block';
....
If you want to go down that route, it can be helpful to understand how
the underlying JavaScript works, but you'll soon get bored with
constantly doing stuff like document.getElementById and might want to
consider a JavaScript library.
I strongly recommend jQuery - the second half of the above code in
jQuery can look like this:
<button onclick="jQuery('#mypopup').hide()">close popup</button>
</div>
....
jQuery('#mypopup').show();
....
But for now that's probably far beyond the scope of your question, so
I'll stop going on. :)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/Javascript/message.cfm/messageid:5192
Subscription: http://www.houseoffusion.com/groups/Javascript/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.33