Re: Label not able to take <p>
- From: "tshad" <t@xxxxxxxx>
- Date: Thu, 6 Sep 2007 17:22:40 -0700
"Göran Andersson" <guffa@xxxxxxxxx> wrote in message
news:%239DwCIO8HHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
tshad wrote:
I have an asp:Label that I am trying display some formatted text.
I can do this in my aspx page, but not from Javascript where I am getting
the text from the opener. I couldn't figure out why my script stopped
executing until I realized what was happening.
In my script I am doing this:
var toCoverLetterDisplay =
document.getElementById('_ctl0_ResumeDisplay_CoverLetterDisplay');
CoverLetterDisplay is an asp:Label which renders into a span element.
So
<asp:Label Text="<p>This is the CoverLetterDisplay</p>"
ID="CoverLetterDisplay" runat=server/>
Renders into
<span id="_ctl0_ResumeDisplay_CoverLetterDisplay"><p>This is the
CoverLetterDisplay</p></span>
In my asp code I can do:
CoverLetterDisplay.Text = "<p>This is the text from the
CoverLetterTextBox.</p>"
I can also do:
toCoverLetterDisplay.innerHTML = "This is a test"
But I can't do:
toCoverLetterDisplay.innerHTML = "<p>This is a test</p>;
or
var test = "<p>This is a test</p>";
toCoverLetterDisplay.innerHTML = test;
What is the problem?
I assume this has something to do with the chevrons.
The problem is that I am trying to move Formatted text from a textarea on
my opener page to an asp:Label on my new page. How do I do this in my
JavaScript function?
Thanks,
Tom
The paragraph tag is a block tag while a span is an inline tag. You can't
place block tags inside inline tags.
Use a Panel instead of the Label.
That did it.
But why can I set the asp:Label fine but not the <span> if the asp:Label
renders into a <span> tag?
Thanks,
Tom
--
Göran Andersson
_____
http://www.guffa.com
.
- Follow-Ups:
- Re: Label not able to take <p>
- From: tshad
- Re: Label not able to take <p>
- References:
- Label not able to take <p>
- From: tshad
- Re: Label not able to take <p>
- From: Göran Andersson
- Label not able to take <p>
- Prev by Date: Re: Label not able to take <p>
- Next by Date: Re: getElementById doesn't seem to work
- Previous by thread: Re: Label not able to take <p>
- Next by thread: Re: Label not able to take <p>
- Index(es):
Relevant Pages
|