| In our previous alert, all the text was on one line.
Sometimes we want to put the text in two or more lines. You can see text in two or more
lines in the following alert:
We achieve this by using the following code:
<script type="text/javascript">
<!--//
function alert2()
{
alert ("Don't forget the curly "+
"brackets - \nThey are essential!");
}
//-->
</script>
I don't suppose I have to tell you how we made a new line? That funny \n
thing gave the game away! You couldn't miss it. (I bet I could if I were learning
JavaScript, though!)
If we break a line of text, that is,
begin on one line and end on another, then we must end one part with a quotation mark and
a plus sign ("+) and begin the new line with a quotation
mark (").
Let's put some data into the program next!
Next:
|