Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: javascript causing line breaks

Reply
Thread Tools

Re: javascript causing line breaks

 
 
PJ
Guest
Posts: n/a
 
      08-01-2003
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", "javascriptpenNotes('" + key + "')")


"Sasha Shevelev" <(E-Mail Removed)> wrote in message
news:Ojb$(E-Mail Removed)...
> 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
>
>
>
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Sasha Shevelev
Guest
Posts: n/a
 
      08-04-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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", "javascriptpenNotes('" + key +

"')")
>
>
> "Sasha Shevelev" <(E-Mail Removed)> wrote in message
> news:Ojb$(E-Mail Removed)...
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >

>
>



 
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
Line breaks in list causing a small formatting problem while joiningthe list Oltmans Python 2 01-21-2011 06:54 PM
inserting line breaks in text quoted in javascript alice Javascript 19 03-24-2007 01:30 AM
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Force multi line field value to output with line breaks? bernadou ASP .Net Web Controls 2 01-23-2006 01:23 PM
Line breaks in string containing Javascript Travis Pupkin ASP General 4 12-10-2004 08:33 AM



Advertisments