473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unterminated String Constant

Hello, I have this functions which opens a new window. The function
works fine if lines 6 and 7 are omitted. But those lines are important
for the next processes so I cant just erase it. Somebody help. It's
been almost 1 day.

1 function test()
2 {
winReport=window.open('','winReport','width=900,he ight=500,left=50,top=100,menubar=0,toolbar=0,statu s=0,scrollbars=1,resizable=0,titlebar=0');
3
4 winReport.document.write('<html>');
5 winReport.document.write('<head>');
6 winReport.document.writeln('<script language=javascript src="..\\js
\\format.js"></script>');
7 winReport.document.writeln('<script language=javascript src="..\\js
\\utility.js"></script>');
8 winReport.document.writeln('<title>Testing</title>');
9 winReport.document.writeln('<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">');
10 winReport.document.writeln('</head>');
................................
}

Apr 2 '07 #1
9 4182
IveCal wrote:
Hello, I have this functions which opens a new window. The function
works fine if lines 6 and 7 are omitted. But those lines are important
for the next processes so I cant just erase it. Somebody help. It's
been almost 1 day.

1 function test()
2 {
winReport=window.open('','winReport','width=900,he ight=500,left=50,top=100,menubar=0,toolbar=0,statu s=0,scrollbars=1,resizable=0,titlebar=0');
3
4 winReport.document.write('<html>');
5 winReport.document.write('<head>');
6 winReport.document.writeln('<script language=javascript src="..\\js
\\format.js"></script>');
7 winReport.document.writeln('<script language=javascript src="..\\js
\\utility.js"></script>');
8 winReport.document.writeln('<title>Testing</title>');
9 winReport.document.writeln('<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">');
10 winReport.document.writeln('</head>');
................................
}
I suggest you learn how to use the DOM methods to build dynamic content,
rather than using document.write.

--
Ian Collins.
Apr 2 '07 #2
Ian Collins <ia******@hotmail.comwrote:
IveCal wrote:
>Hello, I have this functions which opens a new window. The function
works fine if lines 6 and 7 are omitted. But those lines are
important for the next processes so I cant just erase it. Somebody
help. It's been almost 1 day.

1 function test()
2 {
winReport=window.open('','winReport','width=900,h eight=500,left=50,top
=100,menubar=0,toolbar=0,status=0,scrollbars=1,re sizable=0,titlebar=0'
); 3
4 winReport.document.write('<html>');
5 winReport.document.write('<head>');
6 winReport.document.writeln('<script
language=javascript src="..\\js \\format.js"></script>');
7 winReport.document.writeln('<script
language=javascript src="..\\js \\utility.js"></script>');
8 winReport.document.writeln('<title>Testing</title>');
9 winReport.document.writeln('<meta
http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
10 winReport.document.writeln('</head>');
................................
}
I suggest you learn how to use the DOM methods to build dynamic
content, rather than using document.write.
Another good tip would be to always write Javascript in separately included
files, never try to embed it in the middle of HTML. That way the OP won't
have to worry about </scriptterminating his script blocks.

If you want a new window or frame with some initial content it really is
much easier just to put a blank template on the server, open the window to
that URL and then use DOM methods to manipulate the content. Avoid mixing
HTML into Javascript just like you should avoid putting Javascript in HTML.
Apr 2 '07 #3
Ian Collins wrote on 02 apr 2007 in comp.lang.javascript:
IveCal wrote:
>Hello, I have this functions which opens a new window. The function
works fine if lines 6 and 7 are omitted. But those lines are
important for the next processes so I cant just erase it. Somebody
help. It's been almost 1 day.

1 function test()
2 {
winReport=window.open('','winReport','width=900,h eight=500,left=50,top
=100,menubar=0,toolbar=0,status=0,scrollbars=1,re sizable=0,titlebar=0'
); 3
4 winReport.document.write('<html>');
5 winReport.document.write('<head>');
6 winReport.document.writeln('<script
language=javascript src="..\\js \\format.js"></script>');
7 winReport.document.writeln('<script
language=javascript src="..\\js \\utility.js"></script>');
8 winReport.document.writeln('<title>Testing</title>');
9 winReport.document.writeln('<meta
http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
10 winReport.document.writeln('</head>');
................................
}
I suggest you learn how to use the DOM methods to build dynamic
content, rather than using document.write.
Using the DOM to populate an empty new window seems impossible to me,
however, having a filled window available for downloading is far mor
reliable.

Do not use language=javascript but the typed version:
type='text/javascript',

.... and do var any new variables,

.... and most important, methinks,
not use '</script>' inside a script but '<'+'/script>'.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 2 '07 #4
Evertjan. said the following on 4/2/2007 4:16 AM:
Ian Collins wrote on 02 apr 2007 in comp.lang.javascript:
>IveCal wrote:
>>Hello, I have this functions which opens a new window. The function
works fine if lines 6 and 7 are omitted. But those lines are
important for the next processes so I cant just erase it. Somebody
help. It's been almost 1 day.

1 function test()
2 {
winReport=window.open('','winReport','width=900, height=500,left=50,top
=100,menubar=0,toolbar=0,status=0,scrollbars=1,r esizable=0,titlebar=0'
); 3
4 winReport.document.write('<html>');
5 winReport.document.write('<head>');
6 winReport.document.writeln('<script
language=javascript src="..\\js \\format.js"></script>');
7 winReport.document.writeln('<script
language=javascript src="..\\js \\utility.js"></script>');
8 winReport.document.writeln('<title>Testing</title>');
9 winReport.document.writeln('<meta
http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
10 winReport.document.writeln('</head>');
................................
}
I suggest you learn how to use the DOM methods to build dynamic
content, rather than using document.write.

Using the DOM to populate an empty new window seems impossible to me,
however, having a filled window available for downloading is far mor
reliable.

Do not use language=javascript but the typed version:
type='text/javascript',
Why? Both are deprecated.
... and do var any new variables,
Yes.
... and most important, methinks,
not use '</script>' inside a script but '<'+'/script>'.
I prefer '<\/script>'

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 2 '07 #5
Randy Webb wrote:
>Do not use language=javascript but the typed version:
type='text/javascript',

Why? Both are deprecated.
Yes, but
<url: http://www.jibbering.com/faq/faq_notes/script_tags.html >
has this for HTML 4.01:

<!ELEMENT SCRIPT - - %Script; -- script statements -->
<!ATTLIST SCRIPT

type %ContentType; #REQUIRED - content type of script language -

and the note that:

"So for the present, and probably many years to come, text/javascript is
the only viable value for use with the type attribute when using
javascript."

Andrew Poulos
Apr 2 '07 #6
On Apr 2, 10:04 pm, Andrew Poulos <ap_p...@hotmail.comwrote:
Randy Webb wrote:
Do not use language=javascript but the typed version:
type='text/javascript',
Why? Both are deprecated.
I'll accept that in HTML the language attribute is deprecated for
script elements, but do you (Randy) have a reference in regard to
"text/javascript"?

Yes, but
<url:http://www.jibbering.com/faq/faq_notes/script_tags.html>
has this for HTML 4.01:

<!ELEMENT SCRIPT - - %Script; -- script statements -->
<!ATTLIST SCRIPT

type %ContentType; #REQUIRED - content type of script language -

and the note that:

"So for the present, and probably many years to come, text/javascript is
the only viable value for use with the type attribute when using
javascript."
What Randy is referring to is the fact that although the type
attribute is mandatory for valid HTML, the impact of omitting it is
negligible provided one has not previously convinced IE that the
script language in use is VBScript.

He is also obliquely referring to the fact that in April 2006 the
following RFC appeared:

<URL: http://tools.ietf.org/html/rfc4329 >

which proposes:

- text/javascript (obsolete)
- application/javascript
- text/ecmascript (obsolete)
- application/ecmascript

It caused something of a stir.

The bottom line is that you can nearly always safely omit the type
attribute, but if valid HTML counts, include type="text/javascript"
and accept that while there is no official sanction for text/
javascript, nearly any other value will cause the content to be
ignored in at least some browsers.
--
Rob

Apr 2 '07 #7
RobG said the following on 4/2/2007 9:09 AM:
On Apr 2, 10:04 pm, Andrew Poulos <ap_p...@hotmail.comwrote:
>Randy Webb wrote:
>>>Do not use language=javascript but the typed version:
type='text/javascript',
Why? Both are deprecated.

I'll accept that in HTML the language attribute is deprecated for
script elements, but do you (Randy) have a reference in regard to
"text/javascript"?
It has never really made a big difference to me to be honest. I just get
amused when I see people saying you *must* use it because the W3C says
you must yet there is no browser (short of IE's cluster-screw with
VBScript) where it makes a hill of beans difference whether it is there
or not. Yet most of the people saying "use type attribute" or "you must
have the type attribute" normally don't know why it makes any difference
other than "The W3C says you have to use it".
>Yes, but
<url:http://www.jibbering.com/faq/faq_notes/script_tags.html>
has this for HTML 4.01:

<!ELEMENT SCRIPT - - %Script; -- script statements -->
<!ATTLIST SCRIPT

type %ContentType; #REQUIRED - content type of script language -

and the note that:

"So for the present, and probably many years to come, text/javascript is
the only viable value for use with the type attribute when using
javascript."

What Randy is referring to is the fact that although the type
attribute is mandatory for valid HTML, the impact of omitting it is
negligible provided one has not previously convinced IE that the
script language in use is VBScript.
He is also obliquely referring to the fact that in April 2006 the
following RFC appeared:
Close but backwards. I was obliquely referring to IE's cluster-screw
with VBScript (which I don't use and it would require an idiot to use it
on the web) and directly referring to the type attribute of
text/javascript being made obsolete.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 2 '07 #8
In comp.lang.javascript message <I-********************@giganews.com>,
Mon, 2 Apr 2007 12:31:10, Randy Webb <Hi************@aol.composted:
>Close but backwards. I was obliquely referring to IE's cluster-screw
with VBScript (which I don't use and it would require an idiot to use
it on the web)
It seems perfectly appropriate to use, on the Web, VBscript in articles
dealing with the use of VBscript in the Web and/or in WSH and/or
elsewhere.

It demonstrates, for example, the errors affecting 2007-12-31 and
2101-01-02.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Apr 2 '07 #9
Dr J R Stockton said the following on 4/2/2007 4:12 PM:
In comp.lang.javascript message <I-********************@giganews.com>,
Mon, 2 Apr 2007 12:31:10, Randy Webb <Hi************@aol.composted:
>Close but backwards. I was obliquely referring to IE's cluster-screw
with VBScript (which I don't use and it would require an idiot to use
it on the web)

It seems perfectly appropriate to use, on the Web, VBscript in articles
dealing with the use of VBscript in the Web and/or in WSH and/or
elsewhere.
Only in the warped minds of individuals who think it makes sense.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 3 '07 #10

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

Similar topics

3
by: noViagraHere | last post by:
What do i need to add to the document line to stop getting an Unterminated String Constant error? itemtocheck = '1300'; document.writeln('<!--#include...
5
by: KathyB | last post by:
Hi, this is the first lines of a function. Although it runs, it still throws an "Unterminated string constant" error in the browser. It is all in one line, just wouldn't fit here. The error...
6
by: Jeff | last post by:
Hi, does anyone know why this: <a onclick="insertatcaret(window.opener.document.formname.fieldname,'<td class="header">')">text</a> returns a "Unterminated String Constant" error message in IE...
2
by: Tav | last post by:
this seems to be a very generic error message, and the fact that i have no way of locating what causes the error is frustrating. anyway, i'll be general with my problem. i have a div on my page...
18
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further...
2
by: polilop | last post by:
When i open my page in IE it shows an error Unterminated string constant om Line..... When i look at the line it shows the line where the </SCRIPT> tag is ???? Moziila dose not see this error,...
5
by: ken s | last post by:
From server-side code I'm using Response.Write to display a javascript alert box. It works fine except when I try to include a new line character, which causes this javascript error: ...
2
by: rajuk | last post by:
Hi i have following code,when i execute this code i got unterminated string constant error.any javascript guru can you look into this please. raju /* The link details */ var links = new Array...
1
by: VUNETdotUS | last post by:
Let's say I have a string: div.innerHTML = "<a onclick='foo(\""+myWord+"\");'></a>"; in IE only (tested version 7) if var myWord = "English" then it works fine but if var myWord = "Modifier...
1
by: buntyindia | last post by:
I am getting the following string from the database using Java Text <p>hi m</p> <p>Do Something</p> <p>&nbsp;</p> that I have to load into a javascript based rich text editor.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.