Forum Moderators: open

Message Too Old, No Replies

insertadjacenthtml and Firefox

The two won't work together.

         

Orange4

2:17 pm on Sep 23, 2006 (gmt 0)



Hi,

I'm new here...

I made a code that works perfectly fine in IE, but not Firefox.
After a little research, I found that the problem was "insertadjacenthtml"...Firefox doesn't support that.

Here's my code:

<script>

moduletitle = 'Title Here';
modulebody = 'Module Content';
sub = subTitle.parentNode.parentNode.parentNode.parentNode.parentNode
sub.insertAdjacentHTML('beforeBegin','<table border="1" cellspacing="0" cellpadding="4" width="100%" class="left"><tr><th valign="top" align="left" class="left">' + moduletitle + '</th></tr><tr><td valign="top" class="left">' + modulebody)
sub.insertAdjacentHTML('beforeBegin','<BR>');
</script>

It doesn't work in Firefox.
Do yall know of any substitute I can stick in there in place of insertadjacenthtml?

Thanks,

-Josh

tedster

7:43 pm on Sep 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the forums - hope we can help.

You're right, insertadjacenthtml is a proprietary Microsoft method. It's non-standard (not in ECMAscript) and so not supported in other browsers. I found an older article with a generic workaround for Netscape 6 and Mozilla (of that time). I believe this approach would still work in versions since then.

[faqts.com...]

Orange4

11:37 pm on Sep 29, 2006 (gmt 0)



Thanks a bunch!
It worked! I never had any idea how to get around stuff like that. I just edited it to fit with my code...and now I have a custom module code for xanga. :D