Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
innerHTML makes life so simple, yet Microsoft can't support it. It would be so easy if they would just support it.

Is there any secret to using innerHTML with IE that I haven't heard of, because I can never get them to work together :-/


Last Edit: Jan 28, 2007 0:50:56 GMT by Mithras


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
I must be rustier than I thought. >_>

document.body.innerHTML += "<b>Blah</b>";

Works fine. And as for your simplicity remark, innerHTML isn't always preferable to stricter DOM methods.


Last Edit: Jan 28, 2007 2:21:15 GMT by Aaron

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
derfleurer said:
I must be rustier than I thought. >_>

document.body.innerHTML += "<b>Blah</b>";

Works fine. And as for your simplicity remark, innerHTML isn't always preferable to stricter DOM methods.


I mean checking for innerHTML. I know it's not the best method, but it's the easiest >.<


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Scorpian

Scorpian Avatar

******
[ Bracket Admin ]

2,457


April 2006
Oh, so you mean that they don't read RegExp the same or something?
wat

Andrew

Andrew Avatar
Advocatus Diaboli

*
New Member

2


January 2007
The innerHTML property isn't part of the W3C DOM. Nevertheless, it enjoys better cross-browser support than other W3C standard properties and methods so I wouldn't think it would be a problem.

However, note;
There’s a specific situation where innerHTML can let you down. If you serve up your XHTML with an XML mime-type, you can’t use innerHTML. If you want your documents to be treated as XML, you’ll have to forego the convenience of HTML-specific properties like innerHTML.


But, Firefox 1.5 and it's predecessors support the use of innerHTML on XHTML documents. It is more compatible to use methods like createTextNode and appendChild but innerHTML is faster. So that's probably the cause of the problem for you, Mithras.


Last Edit: Jan 28, 2007 14:04:16 GMT by Andrew

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
scorpian8867 said:
Oh, so you mean that they don't read RegExp the same or something?


Yes, I'm trying to grab the font tag that the Modify Profile link is in (on your Profile page), and add to it, but IE is making this simple task difficult >.<


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Scorpian

Scorpian Avatar

******
[ Bracket Admin ]

2,457


April 2006
I am having that same exact problem, only a little different. I'm trying to grab the MSN contact information for a profile page mod, and it's not working in IE. It works just fine in Firefox and Opera, both of which are closer to web standards than IE can ever meet. Now, I'm going to have to rewrite the entire code because of it. ::)
wat

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Quotes aren't rendered inside tags in IE.

FF: <a href="?action=whee">Dude</a>
IE: <A HREF=?action=whee>Dude</A>

(Or something like that. :P)

Therefore, you could either do something like /<a href="?\?action=whee"?>.+?<\/a>/i To check the rendered source, put this in the browser URL: javascript:"<xmp>"+document.body.innerHTML+"</xmp>";

It doesn't work in Opera unfortunately, but the fix is "textarea" instead of "xmp" :)

Hope that helps. :P Oh, and Cali taught me that trick.



Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
In internet explorer, innerHTML always returns tag names in uppercase and as Chris said, it only supplies the quotations in certain cases.

Open IE and alert the body's innerHTML here. You'll see that certain attributes are quoted while others are not. I haven't looked into it so i'm not sure why.

Edit: Oh and Chris, I believe it's only the tag names that are uppercase, the attribute names print directly as they appear in the source.





Last Edit: Jan 28, 2007 21:53:54 GMT by Aaron

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
derfleurer said:
Edit: Oh and Chris, I believe it's only the tag names that are uppercase, the attribute names print directly as they appear in the source.


Just checked, and yeah, you're right. :P Also, quotes appears around inline styles. Just thought I'd point that out.

Scorpian

Scorpian Avatar

******
[ Bracket Admin ]

2,457


April 2006
Quotes rarely show up in IE, I know. You use "? instead of ". I learned that a long time ago. I think it's mainly just the rendering technique. You could use DOM to loop through the childnodes instead. Then, you could check for tag names to grab multiple tags. For example: obj.childNodes.nodeName == 'FONT'; or something like that.
wat

Mithras

Mithras Avatar

****
Studio Member

600


July 2006
cddude229 said:
Quotes aren't rendered inside tags in IE.

FF: <a href="?action=whee">Dude</a>
IE: <A HREF=?action=whee>Dude</A>

(Or something like that. :P)


That is something that you should put in big bold red letters with flashing lights around it at the top of the page about innerHTML. :P

I got it to work... I was stumped because I had no way of grabbing the <font> tag with bookmarks in it on other user's pages, but then I realized that they have the Send PM link :P


Support Rob Scuderi, the #1 Penguins Defender!

lucifer said:
"Behold: me! I have authority in this building."

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
I'd just loop HR's personally. *shrugs* :P

newBookmarkLockedFalling