2010-02-05 121 views
0

夥計!我的問題是這個代碼對IE 8的優化(IE 8的第一個按鈕是好的,但第二個不起作用),谷歌瀏覽器(第二個按鈕是好的,但首先不工作)。我已經堆疊起來了,請幫忙。 :)網站頁面按鈕優化問題

第一個按鈕

<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> 

第二個按鈕

<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%;"> 

回答

0

這是從你的代碼直接引用? '因爲檢查它,我可以立即看到,在按鈕1 JavaScript代碼中,有一個'結束丟失,在this.value = Show again?';(應該是this.value = 'Show again?';)。考慮解決這個問題,看看是否有任何改變。