Wrox Programmer Forums
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 18th, 2011, 12:45 PM
Authorized User
 
Join Date: Feb 2011
Posts: 19
Thanks: 2
Thanked 1 Time in 1 Post
Default javascript

Quote:
<script type="text/javascript">
document.write("bob \n tom");

</script>

by writing this code i'm not getting bob and tom on two line
it shows on a single line.
i don't no why \n not work in my code
 
Old February 18th, 2011, 01:40 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Since you write directly to the document, you need HTML breaks. E.g.:

Code:
 
document.write("bob <br /> tom");
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 18th, 2011, 01:52 PM
Authorized User
 
Join Date: Feb 2011
Posts: 19
Thanks: 2
Thanked 1 Time in 1 Post
Default reply

but where and how i use line feed \n
 
Old February 18th, 2011, 01:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

When you need it ;-)

For example, in an alert popup, you need \n. This code

alert("bob \n tom");

pops up a dialog with

bob
tom

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do we need javascript Edward Colins BOOK: Beginning ASP.NET 4 : in C# and VB 7 September 19th, 2010 02:50 PM
stop current javascript function using javascript sakthi Javascript 3 June 2nd, 2008 03:30 PM
"text/javascript" and "javascript" rupen Javascript 1 June 24th, 2005 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.