javascript causing line breaks

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: javascript causing line breaks

    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:openNotes('" + key + "')")


    "Sasha Shevelev" <sashashev@hotmail.com> wrote in message
    news:Ojb$aIEWDHA.2224@TK2MSFTNGP09.phx.gbl...
    > 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('exte ndednotes.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.op en('extendednotes.aspx?key
    >
    =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=n o
    > ,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.op en('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 Guest

  2. Similar Questions and Discussions

    1. PHP deletes .swf line breaks
      Hi all - I have a designed a Flash based interface to send email via PHP. I capture the variables in Flash using: var my_lv:LoadVars=new...
    2. Getting line breaks between words
      Is there a way to have InDesign wrap to a new line between words? Here's why ... I'm working on a VDP (Variable Data Printing) project of an eye...
    3. Get rid of uselses line breaks?
      Greetings, I noticed when I use design mode on Dreamweaver to input text, I get too many line breaks on the source code. Is there a way to...
    4. In correct line breaks in ID2.0J
      Our company produces manuals in several different European languages and as most of the operators are Japanese we use a Japanese version of ID. The...
    5. Line Breaks (DB APP)
      What server model are you using? ASP? PHP? CF? -- Dave ----------------------------------------------------------------- If I were half as...
  3. #2

    Default Re: javascript causing line breaks

    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" <pjwal@hotmail.com> wrote in message
    news:u1MX3nHWDHA.1368@TK2MSFTNGP11.phx.gbl...
    > 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:openNotes('" + key +
    "')")
    >
    >
    > "Sasha Shevelev" <sashashev@hotmail.com> wrote in message
    > news:Ojb$aIEWDHA.2224@TK2MSFTNGP09.phx.gbl...
    > > 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('exte ndednotes.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.op en('extendednotes.aspx?key
    > >
    >
    =18C2B4EB-F8B3-462B-AB74-7307D54DBEF7','ExtendedNotes_window','scrollbars=n o
    > > ,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.op en('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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139