views:

19

answers:

1

Guys! My problem is optimizaiton of this code for IE 8 (with IE 8 first button is ok, but second doesn't work), Google Chrome (second button is ok, but first doesn't work). I've stack with it, help please. :)

FIRST BUTTON

<div id="spoiler">
<div>
<p style="text-align: center;"><input style="margin: 10px; padding: 0px; width: 150px; font-size: 12px; background-color: #fdeaa8;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display = ''; this.parentNode.parentNode.getElementsByTagName('div')['hide'].style.display = 'none'; this.innerText = ''; this.value = 'hide spoiler'; } else { this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display = 'none'; this.parentNode.parentNode.getElementsByTagName('div')['hide'].style.display = ''; this.innerText = ''; this.value = Show again?'; }" type="button" value="Elaya company" /></p>

<div>
<div id="show" style="border-style: solid; border-width: 1px; margin: 0px; padding: 4px; display: none; background-color: transparent; width: 98%;">

</div>

SECOND BUTTON

<div id="spoiler">
<div>
<p style="text-align: center;"><input style="margin: 10px; padding: 0px; width: 150px; font-size: 12px; background-color: #fdeaa8;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display = ''; this.parentNode.parentNode.getElementsByTagName('div')['hide'].style.display = 'none'; this.innerText = ''; this.value = 'Hide spoiler'; } else { this.parentNode.parentNode.getElementsByTagName('div')['show'].style.display = 'none'; this.parentNode.parentNode.getElementsByTagName('div')['hide'].style.display = ''; this.innerText = ''; this.value = 'Show again?'; }" type="button" value="AssolModa company" /></p>

<div id="show" style="border-style: solid; border-width: 1px; margin: 0px; padding: 4px; display: none; background-color: transparent; width: 98%;">
A: 

Is this a direct quote from your code? 'cause examining it, I can immediately see that in Button 1 javascript code, there's a ' missing near the end, in this.value = Show again?'; (should be this.value = 'Show again?';). Consider fixing this and see if anything changes.

Pawel J. Wal