Netscape exhibits the same behavior with spans. And you can create a div after the
page loads, because I did it....
Robert Rainwater wrote:
> I don't believe you can create a div after the page load by just
> writing the html. Try using a span instead or using a font tag.
>
> --
> // Robert Rainwater
>
> On 2/7/2001, 12:39:10 AM EST, Jeff wrote about "[Dynapi-Help] Bizarre solution to
>setHTML and inline styles in NS":
>
> > Sorry I wasn't specific enough...
>
> > What I tried to do initially was something like this:
>
> > function setText(text,fSize,fFamily,fColor) {
>
> > myLayer.setHTML('<DIV STYLE="font-size:' + fSize + ';fontFamily:' +
> > fFamily + ';color:' + fColor + '">' + text + '<DIV>');
>
> > }
>
> > Which didn't work very well. It seemed to work the first time setText
> > was called, but not on any subsequent calls. It would write the text in
> > the layer without the style applied to it, just whatever the browser
> > defaults were. This also seemed to be partly related to how many
> > instances of the widget I had created, but I can't really quantify that
> > behavior at this point.
>
> > What I ended up doing was this:
>
> > function setText(text,fSize,fFamily,fColor) {
>
> > myLayer.setHTML('<DIV STYLE="font-size:' + fSize + ';fontFamily:' +
> > fFamily + ';color:' + fColor + '">' + text + '<DIV><DIV
> > STYLE="font-size:' + fSize +
> > ';fontFamily:' + fFamily + ';color:' + fColor + '">' + text + '<DIV>');
>
> > }
>
> > Just putting two of the exact same DIV into the text passed to setHTML.
> > Why? As I said in my first post, I had some prior experience with
> > Netscape ignoring styles
> > placed into documents with document.write(). Specifically, if I passed
> > document.write() a long text string with many individual words
> > surrounded by DIV layers, it
> > would always ignore the style in the first DIV it encountered. I could
> > do "view-source" and see that the DIV and it's style were in the code,
> > it just wouldn't render it.
> > So.... by passing two identical DIVS in this case, I got it to render
> > the style properly.
>
> > Jeff Greenberg
> > [EMAIL PROTECTED]
>
> > Richard Bennett wrote:
>
> > > passed the setHTML method TWO divs, both exactly the same. BOOM. It
>
> > could you explain exactly what you did please?
>
> > Cheers,
> > Richard Bennett
>
> > [EMAIL PROTECTED]
> > www.richardinfo.com
> > (Everything running on, and ported to the 19/12/2000 snapshot of
> > DynAPI2)
> > ----- Original Message -----
> > From: "Jeff Greenberg" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 07, 2001 12:01 AM
> > Subject: [Dynapi-Help] Bizarre solution to setHTML and inline styles
> > in NS
>
> > > Like others, I have noticed that using setHTML to write styles to
> > nested
> > > layers in Netscape only works sporadically. On the widget I am now
> > > working on, I found that the first time I wrote the style to the
> > nested
> > > layer, it worked fine, but on subsequent setHTML's, it didn't.
> > >
> > > Well, that reminded me of a problem I had encountered while working
> > on
> > > something for my company. I was creating some javascript to
> > highlight
> > > the search terms in text returned from a query by replacing the
> > terms in
> > > the text with <SPAN> tags and appropriate bg colors for
> > highlighting.
> > > Worked fine in IE, but on Netscape, the browser always ignored the
> > style
> > > for the first <SPAN> tag, while rendering the others correctly.
> > >
> > > Now, that's not exactly in line with the above mentioned problem,
> > but it
> > > certainly seemed related to me, so.... in the widget I am working
> > on, I
> > > passed the setHTML method TWO divs, both exactly the same. BOOM. It
>
> > > works.
> > >
> > > This is really a weird kind of bug, but there ya go. If anyone else
> > > tries this out, let me know how it works for you.
> > >
> > > Jeff Greenberg
> > > [EMAIL PROTECTED]
> > >
> > >
> > > _______________________________________________
> > > Dynapi-Help mailing list
> > > [EMAIL PROTECTED]
> > > http://lists.sourceforge.net/lists/listinfo/dynapi-help
> > > ____________________________________________________________
> > > Get your free domain name and domain-based e-mail from
> > > Namezero.com. New! Namezero Plus domains now available.
> > > Find out more at: http://www.namezero.com
> > >
>
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> ----------------------
> DynAPI Snapshots: http://dynapi.sourceforge.net/snapshot/
> DynAPI Homepage: http://dynapi.sourceforge.net/
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help