Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Making Javascript just write the content

Reply
Thread Tools

Making Javascript just write the content

 
 
Laphan
Guest
Posts: n/a
 
      06-18-2006
Hi All

I'm using ASP to squirt some text into JS so that the JS write it into an
iFrame, but JS keeps giving me unterminated string errors when the text is
more than 1 line's worth. I thought JS was free-form!!

My code is simply:

iView.document.write('<P align=center><FONT face=Arial
size=4>ffff</FONT></P>
<P align=center><FONT face=Arial size=4>777</FONT></P>');
iView.document.close();

All of the content between the '..'' in the .write is what comes from my DB
via ASP.

If the content came out as:

iView.document.write('<P align=center><FONT face=Arial
size=4>ffff</FONT></P>');
iView.document.close();

then it works. AAARRRRGGGHHHH!!

Could somebody please advise me on how get JS to work with a (possibly)
large chunk of data with the above.

Thanks

Laphan



 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      06-18-2006

"Laphan" <(E-Mail Removed)> wrote in message
news:%23mP5$(E-Mail Removed)...
> Hi All
>
> I'm using ASP to squirt some text into JS so that the JS write it into an
> iFrame, but JS keeps giving me unterminated string errors when the text is
> more than 1 line's worth. I thought JS was free-form!!
>


Nope it isn't

> My code is simply:
>
> iView.document.write('<P align=center><FONT face=Arial
> size=4>ffff</FONT></P>
> <P align=center><FONT face=Arial size=4>777</FONT></P>');
> iView.document.close();
>
> All of the content between the '..'' in the .write is what comes from my

DB
> via ASP.
>
> If the content came out as:
>
> iView.document.write('<P align=center><FONT face=Arial
> size=4>ffff</FONT></P>');


I assume that when you posted this it was all on one line.

> iView.document.close();
>
> then it works. AAARRRRGGGHHHH!!
>
> Could somebody please advise me on how get JS to work with a (possibly)
> large chunk of data with the above.
>
> Thanks
>
> Laphan


First off this doesn't seem like a sound design. However you could force it
to one line by replacing vbCr with "\r" and vbLF with "\n" (you probably
should replace ' with \'). This would create a string that would all be on
one line. How long the line is allowed to be and whether it is sensible to
have a very long line I don't know. It should work though.



 
Reply With Quote
 
 
 
 
Laphan
Guest
Posts: n/a
 
      06-18-2006
Many thanks for all of your info and help Anthony

Rgds

Laphan


"Anthony Jones" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

"Laphan" <(E-Mail Removed)> wrote in message
news:%23mP5$(E-Mail Removed)...
> Hi All
>
> I'm using ASP to squirt some text into JS so that the JS write it into an
> iFrame, but JS keeps giving me unterminated string errors when the text is
> more than 1 line's worth. I thought JS was free-form!!
>


Nope it isn't

> My code is simply:
>
> iView.document.write('<P align=center><FONT face=Arial
> size=4>ffff</FONT></P>
> <P align=center><FONT face=Arial size=4>777</FONT></P>');
> iView.document.close();
>
> All of the content between the '..'' in the .write is what comes from my

DB
> via ASP.
>
> If the content came out as:
>
> iView.document.write('<P align=center><FONT face=Arial
> size=4>ffff</FONT></P>');


I assume that when you posted this it was all on one line.

> iView.document.close();
>
> then it works. AAARRRRGGGHHHH!!
>
> Could somebody please advise me on how get JS to work with a (possibly)
> large chunk of data with the above.
>
> Thanks
>
> Laphan


First off this doesn't seem like a sound design. However you could force it
to one line by replacing vbCr with "\r" and vbLF with "\n" (you probably
should replace ' with \'). This would create a string that would all be on
one line. How long the line is allowed to be and whether it is sensible to
have a very long line I don't know. It should work though.




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
How do you write JavaScript in document.write and have it workproperly? Frank Peterson Javascript 9 06-28-2009 03:43 AM
Re: A fresh new approach to making making online Fakename Computer Information 0 11-18-2005 02:10 AM
Making new Flavors : Making a custom transferhandler for and drop applications ebby83@gmail.com Java 5 01-12-2005 11:10 AM
making the content of the site dynamically Bernie V ASP .Net 0 01-21-2004 10:14 AM



Advertisments