Re: javascript causing line breaks

Discussion in 'ASP .Net' started by PJ, Aug 1, 2003.

  1. PJ

    PJ Guest

    for something like this I usuallly define a function at the bottom of the
    page:

    <!-- bottom of page -->
    function openNotes(key) {
    var windowFeatures = 'scrollbars=no,width=480,height=300';
    var ExtendedNotes_window = window.open('extendednotes.aspx?key=' +
    key,'ExtendedNotes_window', windowFeatures);
    ExtendedNotes_window.focus();
    }

    <!-- in page -->
    <asp:textbox id="txtDetails" maxlength="20" readonly="true"
    class="soft"></asp:textbox>

    'code behind
    Dim txtDetails As TextBox = CType(e.Item.FindControl("txtDetails"), TextBox)
    txtDetails.Attributes.Add("onclick", "javascript:eek:penNotes('" + key + "')")


    "Sasha Shevelev" <> wrote in message
    news:Ojb$...
    > Hi there,
    >
    > I can;t believe no one else has had this prob but here goes...
    >
    > I add some javascript into my page and asp.net sometimes (not always) puts
    > the js into my page with a line break rendering it useless...
    >
    >
    > Here is my code...
    >
    > Dim txtDetails As TextBox = CType(e.Item.FindControl("txtDetails"),

    TextBox)
    > 'Create the javascript string
    >
    > strJS =
    > "javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key=" &

    key
    > &
    >

    "','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNote
    > s_window.focus()"
    >
    > txtDetails.Attributes.Add("onClick", strJS)
    >
    >
    >
    > Here is the source wjhen it runs.....
    >
    > When it works the source code looks like (take wrapping off) - <input
    > name="dgrdTimeSheet:_ctl2:txtDetails" type="text" maxlength="20"
    > readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails" class="soft"
    >

    onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
    >

    =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=no
    > ,width=480,height=300');ExtendedNotes_window.focus()" style="width:80px;"

    />
    >
    > When it doesn't - <input name="dgrdTimeSheet:_ctl2:txtDetails" type="text"
    > maxlength="20" readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails"
    > class="soft"
    >

    onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
    > =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7
    >

    ','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNotes
    > _window.focus()" style="width:80px;" />
    >
    > This obviously causes unterminated string constant. It's not the editor I
    > view my source in either. I saw another posting similar to mine and the

    guy
    > had checked all the characters but no one provided an answer to him.
    >
    > This is really urgent. Can anyone help????
    >
    > Thanks,
    >
    > Sasha
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    PJ, Aug 1, 2003
    #1
    1. Advertising

  2. Thx fixed,

    but why does .net put the line break in?

    It can;t be a length thing cause it doesn't always happen.

    Pretty poor.

    Cheers,

    Sasha
    "PJ" <> wrote in message
    news:...
    > for something like this I usuallly define a function at the bottom of the
    > page:
    >
    > <!-- bottom of page -->
    > function openNotes(key) {
    > var windowFeatures = 'scrollbars=no,width=480,height=300';
    > var ExtendedNotes_window = window.open('extendednotes.aspx?key=' +
    > key,'ExtendedNotes_window', windowFeatures);
    > ExtendedNotes_window.focus();
    > }
    >
    > <!-- in page -->
    > <asp:textbox id="txtDetails" maxlength="20" readonly="true"
    > class="soft"></asp:textbox>
    >
    > 'code behind
    > Dim txtDetails As TextBox = CType(e.Item.FindControl("txtDetails"),

    TextBox)
    > txtDetails.Attributes.Add("onclick", "javascript:eek:penNotes('" + key +

    "')")
    >
    >
    > "Sasha Shevelev" <> wrote in message
    > news:Ojb$...
    > > Hi there,
    > >
    > > I can;t believe no one else has had this prob but here goes...
    > >
    > > I add some javascript into my page and asp.net sometimes (not always)

    puts
    > > the js into my page with a line break rendering it useless...
    > >
    > >
    > > Here is my code...
    > >
    > > Dim txtDetails As TextBox = CType(e.Item.FindControl("txtDetails"),

    > TextBox)
    > > 'Create the javascript string
    > >
    > > strJS =
    > > "javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key=" &

    > key
    > > &
    > >

    >

    "','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNote
    > > s_window.focus()"
    > >
    > > txtDetails.Attributes.Add("onClick", strJS)
    > >
    > >
    > >
    > > Here is the source wjhen it runs.....
    > >
    > > When it works the source code looks like (take wrapping off) - <input
    > > name="dgrdTimeSheet:_ctl2:txtDetails" type="text" maxlength="20"
    > > readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails" class="soft"
    > >

    >

    onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
    > >

    >

    =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=no
    > > ,width=480,height=300');ExtendedNotes_window.focus()"

    style="width:80px;"
    > />
    > >
    > > When it doesn't - <input name="dgrdTimeSheet:_ctl2:txtDetails"

    type="text"
    > > maxlength="20" readonly="readonly" id="dgrdTimeSheet__ctl2_txtDetails"
    > > class="soft"
    > >

    >

    onClick="javascript:ExtendedNotes_window=window.open('extendednotes.aspx?key
    > > =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7
    > >

    >

    ','ExtendedNotes_window','scrollbars=no,width=480,height=300');ExtendedNotes
    > > _window.focus()" style="width:80px;" />
    > >
    > > This obviously causes unterminated string constant. It's not the editor

    I
    > > view my source in either. I saw another posting similar to mine and the

    > guy
    > > had checked all the characters but no one provided an answer to him.
    > >
    > > This is really urgent. Can anyone help????
    > >
    > > Thanks,
    > >
    > > Sasha
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Sasha Shevelev, Aug 4, 2003
    #2
    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. Oltmans
    Replies:
    2
    Views:
    262
  2. bernadou

    Force multi line field value to output with line breaks?

    bernadou, Jan 22, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    370
    bernadou
    Jan 23, 2006
  3. Travis Pupkin

    Line breaks in string containing Javascript

    Travis Pupkin, Dec 9, 2004, in forum: ASP General
    Replies:
    4
    Views:
    232
    Travis Pupkin
    Dec 10, 2004
  4. Marek Stepanek
    Replies:
    12
    Views:
    422
    Peter J. Holzer
    Sep 2, 2006
  5. alice
    Replies:
    19
    Views:
    265
    alice
    Mar 24, 2007
Loading...

Share This Page