Wrox Programmer Forums
|
BOOK: Professional Web 2.0 Programming
This is the forum to discuss the Wrox book Professional Web 2.0 Programming by Eric van der Vlist, Danny Ayers, Erik Bruchez, Joe Fawcett, Alessandro Vernet; ISBN: 9780470087886
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web 2.0 Programming 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 March 29th, 2010, 06:23 AM
Authorized User
 
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
Default new line in constant

how to writ such this without errors:
Code:
Response.write("document.write(\"
                      <table>
                      <tr><td>aa</td></tr>
                      <tr><td>aa</td></tr>
                      </table>
\");");
how to nest the code like that?
Now I have an error says "new line in constants";
__________________
ASP.NET & C#
 
Old March 29th, 2010, 09:55 AM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Try the following (I didn't test):
Code:
Response.write(@"document.write('
                      <table>
                      <tr><td>aa</td></tr>
                      <tr><td>aa</td></tr>
                      </table>
');");
 
Old March 29th, 2010, 10:46 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

What is giving the error message? Is it the server-side code or the client-side?
__________________
Joe
http://joe.fawcett.name/
 
Old March 29th, 2010, 01:03 PM
Authorized User
 
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
Default

server side
__________________
ASP.NET & C#
 
Old March 29th, 2010, 08:52 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

This satisfies both C# and javascript:

Code:
                Response.Write(@"document.write('hello \
                world')");
@ is used to satisfy C# and \ is for javascript.
 
Old March 30th, 2010, 12:56 PM
Authorized User
 
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
Default

Code:
        Response.ContentType = "text/x-javascript";
        Response.Write(@"document.write('hello 
                world')");
for that it did not work.. please repair it more.
__________________
ASP.NET & C#
 
Old March 30th, 2010, 08:45 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

You missed that "\" when you copied my example.
 
Old March 31st, 2010, 03:53 AM
Authorized User
 
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
Default

but when implementing this with it, it did not benifit
Code:
Response.ContentType = "text/x-javascript";
__________________
ASP.NET & C#
 
Old March 31st, 2010, 09:07 AM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

"text/x-javascript" only gives you trouble - not all browsers support it, so move away from it, and use "text/javascript".

For the same reason, don't use "application/javascript" or "application/x-javascript".
 
Old March 31st, 2010, 09:58 AM
Authorized User
 
Join Date: Feb 2008
Posts: 89
Thanks: 13
Thanked 0 Times in 0 Posts
Default

I used text/javascript". but still problem
__________________
ASP.NET & C#





Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue using "saxon:line-number()" in command line XSL with Saxon9.jar ROCXY XSLT 3 June 3rd, 2009 04:24 AM
How to draw indicator line in owc line chart AlexOo General .NET 0 July 9th, 2007 10:32 PM
How to read file line by line in EVC++ iriskab Visual C++ 0 September 27th, 2006 01:39 PM
Reading line by line from a .txt file x_ray VB.NET 2002/2003 Basics 5 February 10th, 2006 01:55 PM
New Line String Constant Paula222 Access VBA 2 February 8th, 2006 12:36 PM





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