| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 254
![]() ![]() ![]() | Javascript not working in IE Any reason to why the following code wont work when using IE? <div id="fields3">Bla bla<input name='frakt' type='radio' class='rad' value='org' onclick="document.getElementById('levvy').innerHTM L = '<p>Bla bla</p> <br /> <p>Bla bla</p> <br /> <p>Bla bla</p>'" /></div> <p class="checkout" id="levvy">Blabla</p> It works in all other browsers. It also works in IE if I remove the html-tags. Any ideas or alternative solutions? |
| |
| | #4 (permalink) |
| New Member Join Date: Jun 2008
Posts: 20
![]() | You can also try using outerHTML - though that can cause headaches in Firefox. Honestly though - this form of DOM manipulation is fairly old school - you might want to try using something like jQuery - if you can take the slight overhead - it makes all of these things a snap - and handles the cross browser issues for you... |
| |
| | #6 (permalink) |
| NamePros Regular Join Date: Mar 2006
Posts: 623
![]() ![]() | I second that recommendation to look at jQuery. It makes manipulating html or css very simple and easy to read. It also separates the html from the javascript which makes things so much more readable.
__________________ Forum Posters |
| |
| | #7 (permalink) |
| New Member Join Date: Jul 2008
Posts: 12
![]() | Just make it compatible by using innerHTML and outerHTML .. etc example Code: if(navigator.appName.indexOf("Mozilla") == -1)
{
document.getElementById('levvy').innerHTML = "Mozilla content";
} else {
document.getElementById('levvy').outerHTML = "IE content";
} ????: NamePros.com http://www.namepros.com/programming/488017-javascript-not-working-in-ie.html Hope it helps.
__________________ Buying and selling domains, established websites and marketing advices since 2004. |
| |