HTML Help Forum HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

OnClick Problem
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum -> Javascript
View previous topic :: View next topic  
Author Message
jimk



Joined: 20 Nov 2006
Posts: 7

Posted: Fri Jul 17, 2009 4:13 am     OnClick Problem  

I am using the OnClick alert on my web site to provide information about various subjects and the below code works fine:
<a href="#" onclick="alert('**** *****')">3</a>
it displays the desired information on a single line,
however, some times I want multiple lines of info to be displayed but I can't seem to make it work. I've used the <br> and <br /> codes but that doesn't work.
Can someone provide a better way?

jimk
PayneLess Designs



Joined: 28 Feb 2007
Posts: 4289
Location: MS

Posted: Fri Jul 17, 2009 3:16 pm      

Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
 <script type="text/javascript"><!--
function disp_alert()
{
alert("Hello world! This is how to" + '\n' + "add line breaks to an alert box!")
}
//--></script>
</head>
<body>
<p><input type="button" onclick="disp_alert()" value="Display Alert Box" /></p>
</body></html>

jimk



Joined: 20 Nov 2006
Posts: 7

Posted: Sat Jul 18, 2009 2:21 am      

Thanks for the help.

jimk
PayneLess Designs



Joined: 28 Feb 2007
Posts: 4289
Location: MS

Posted: Sat Jul 18, 2009 10:38 am      

You're very welcome.
 
 
DARFUR
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum -> Javascript
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group