[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-01-2008, 03:33 AM   #1 (permalink)
NamePros Member
 
Join Date: Apr 2006
Posts: 150
0.00 NP$ (Donate)

Wuoshi is on a distinguished road


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?
__________________
Organic beauty www.onlyorganic.no
Wuoshi is offline  
Old 07-01-2008, 09:13 AM   #2 (permalink)
NamePros Member
 
Join Date: Sep 2006
Posts: 87
100.00 NP$ (Donate)

Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough


I would recommend making "levvy" a <div>, or some sort of other element to see if it works that way.
Putting a <p> inside of another <p> is probably too much for IE to handle.


Bruce
Bruce_KD is offline  
Old 07-01-2008, 11:13 AM   #3 (permalink)
NamePros Member
 
Join Date: Apr 2006
Posts: 150
0.00 NP$ (Donate)

Wuoshi is on a distinguished road


You dah man!! I should've thought about that!

Repped, thank you!
__________________
Organic beauty www.onlyorganic.no
Wuoshi is offline  
Old 07-02-2008, 10:17 AM   #4 (permalink)
New Member
 
Join Date: Jun 2008
Posts: 20
0.00 NP$ (Donate)

kceleb9 is an unknown quantity at this point


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...
kceleb9 is offline  
Old 07-02-2008, 11:35 PM   #5 (permalink)
NamePros Member
 
Join Date: Apr 2006
Posts: 150
0.00 NP$ (Donate)

Wuoshi is on a distinguished road


Thanks, will look into it.
__________________
Organic beauty www.onlyorganic.no
Wuoshi is offline  
Old 07-04-2008, 11:29 AM   #6 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Posts: 623
237.00 NP$ (Donate)

obvio will become famous soon enoughobvio will become famous soon enough


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
obvio is offline  
Old 07-19-2008, 09:19 AM   #7 (permalink)
New Member
 
Join Date: Jul 2008
Posts: 12
0.00 NP$ (Donate)

edomainsuk is an unknown quantity at this point


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";
 }
or instead of using div's and <p> with id's just use "document.write();" .. that way it won't be neither of those to outhandle.

Hope it helps.
__________________
Buying and selling domains, established websites and marketing advices since 2004.
edomainsuk is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 03:30 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85