Making Javascript just write the content

Discussion in 'ASP General' started by Laphan, Jun 18, 2006.

  1. Laphan

    Laphan Guest

    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
    Laphan, Jun 18, 2006
    #1
    1. Advertising

  2. "Laphan" <> wrote in message
    news:%23mP5$...
    > 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.
    Anthony Jones, Jun 18, 2006
    #2
    1. Advertising

  3. Laphan

    Laphan Guest

    Many thanks for all of your info and help Anthony

    Rgds

    Laphan


    "Anthony Jones" <> wrote in message
    news:...

    "Laphan" <> wrote in message
    news:%23mP5$...
    > 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.
    Laphan, Jun 18, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hazz
    Replies:
    6
    Views:
    49,551
    SkyUCHC
    Jun 9, 2010
  2. walterbyrd
    Replies:
    1
    Views:
    351
    Damjan
    Apr 10, 2006
  3. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C++
    Replies:
    24
    Views:
    740
    Lionel B
    Jul 16, 2007
  4. Ark Khasin

    Is it just me or just Microsoft?

    Ark Khasin, Jul 15, 2007, in forum: C Programming
    Replies:
    42
    Views:
    1,123
    user923005
    Jul 17, 2007
  5. Tomás Ó hÉilidhe

    Rebirthing an object... just making sure

    Tomás Ó hÉilidhe, Jan 9, 2008, in forum: C++
    Replies:
    18
    Views:
    505
    Alf P. Steinbach
    Jan 11, 2008
Loading...

Share This Page