473,785 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to create a MultiLine string

I want to create a multiline string that can works in ie and
firefox,
who have a better idea ?

Aug 24 '07 #1
8 8027
I want to define a multiline string.

like:

var html = "<html>
<body>
</body>
</html>
.....
"
but i don't want to use '\'

Aug 24 '07 #2
hong hua wrote on 24 aug 2007 in comp.lang.javas cript:
I want to define a multiline string.
Are you responding on a previous posting? [Re: ..]

Please always quote on usenet!
like:

var html = "<html>
<body>
</body>
</html>
....
"
Why do you want to do that, Hua?
but i don't want to use '\'
Why don't you want to do that?

How could you use '\' for that?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 24 '07 #3
if i want to store the following html code in a variable(javasc ript of
course) ,
Do you have a better idea?

=============== === HTML Start =============== =======
I want to define a multiline string.
Are you responding on a previous posting? [Re: ..]

Please always quote on usenet!
like:
var html = "<html>
<body>
</body>
</html>
....
"
<script language="javas cript">
alert("hello world");
</script>
=============== == HTML End =============== ========

Aug 24 '07 #4
we************* @gmail.com wrote:
I want to define a multiline string.

like:

var html = "<html>
<body>
</body>
</html>
....
"
but i don't want to use '\'
var html = "<html>" +
"<body>" +
"<\/body>" +
"<\/html>";

http://javascript.crockford.com/
Aug 24 '07 #5
On Aug 24, 12:23 am, Douglas Crockford <nos...@sbcglob al.netwrote:
weizhonghua.... @gmail.com wrote:
I want to define a multiline string.
like:
var html = "<html>
<body>
</body>
</html>
....
"
but i don't want to use '\'

var html = "<html>" +
"<body>" +
"<\/body>" +
"<\/html>";
Why escape the '/' on the closing tags? I have only read that is
necessary for script tags. Do HTML parsers exist that have a problem
with those closing tags or are you just being conservative?

I find it a easier to use single quotes when quoting HTML because then
attribute double quotes don't need escaping.

"<li id=\"foo\">"
'<li id="foo">'

Peter

Aug 24 '07 #6
Douglas Crockford wrote on 24 aug 2007 in comp.lang.javas cript:
we************* @gmail.com wrote:
>I want to define a multiline string.

like:

var html = "<html>
<body>
</body>
</html>
....
"
but i don't want to use '\'

var html = "<html>" +
"<body>" +
"<\/body>" +
"<\/html>";

http://javascript.crockford.com/
But Douglas, she does not want to use "\"!

var sl = String.fromChar Code(47);

var html = '<html>' +
'<body>' +
'<'+sl+'body>' +
'<'+sl+'html>' ;

alert(html);
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 24 '07 #7
Douglas Crockford wrote:
we************* @gmail.com wrote:
>I want to define a multiline string.
[...]
but i don't want to use '\'

var html = "<html>" +
"<body>" +
"<\/body>" +
"<\/html>";
I would always prefer

var html = new Array(
"<html>",
" <body>"
" <\/body>",
"<\/html>"
).join("\n");

above that.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Aug 24 '07 #8
Thomas 'PointedEars' Lahn wrote:
Peter Michaux wrote:
>I find it a easier to use single quotes when quoting HTML because then
attribute double quotes don't need escaping.

"<li id=\"foo\">"
'<li id="foo">'

Add me. However, it is perfectly Valid to use apostrophes ("single quotes")
as attribute delimiter as well, even in X(HT)ML.
That should have been "attribute _value_ delimiter".
(Unfortunately, the SGML spec is not available free of charge at ISO.)
However, the SGML productions provide a fair idea:

http://www.w3.org/MarkUp/SGML/productions.html
http://www.w3.org/MarkUp/SGML/productions.html#prod32
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Aug 24 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1958
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead of escaping the \n's. A repr function that output triple-quoted strings with explicit (non-escaped) linebreaks would be perfect.
6
12750
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
4
31063
by: Michael C | last post by:
Hi all, I'm trying to add lines to a multiline textbox. Here's what I'd like to end up with in the textbox (as an example): Line1 Line2 Line3 I've tried a couple of methods but nothing seems to be working. Code like
0
2180
by: Anonieko Ramos | last post by:
> I have a graphics images that I want to convert to > ASCII art. How do I do it? > Code: - Default.aspx.cs
9
3180
by: John Salerno | last post by:
How do you make a single string span multiple lines, but also allow yourself to indent the second (third, etc.) lines so that it lines up where you want it, without causing the newlines and tabs or spaces to be added to the string as well? Example (pretend this is all on one line): self.DTD = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"\n"http://www.w3.org/TR/html4/strict.dtd">\n\n'
9
24268
by: Alex | last post by:
Hi all - Read here that embedding \n's into the tooltip string during runtime should yeild multiline tooltips. However, mine is just keeping the \n's in there and showing it all on one line. Any idea how I get it to parse the control chars? I'm doing something like this:
2
3671
by: BillE | last post by:
I need to create a multi-line label dynamically. Since labels aren't multi-line, I'm creating a textbox and making it look like a label with the multiline property set to true. I want to increase the height of the textbox only if there are multiple lines, and leave it at the default height if the text does not wrap after setting the Text property. I thought I could use the Lines property after setting the Text property,
7
2963
by: abcd | last post by:
When do I need to use a trailing slash to separate code over multiple lines. For example: x = "hello world, this is my multiline " + \ "string!!!!" x = {'name' : \ 'bob'}
7
15489
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of strings which I want to "paste" into a multiline textbox. Any ideas? -- Anil Gupte www.keeninc.net www.icinema.com
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.