Html 网站页面上按钮的优化问题

Html 网站页面上按钮的优化问题,html,optimization,internet-explorer-8,google-chrome,Html,Optimization,Internet Explorer 8,Google Chrome,伙计们!我的问题是针对IE8(使用IE8第一个按钮可以,但第二个按钮不起作用)、GoogleChrome(第二个按钮可以,但第一个按钮不起作用)优化这段代码。我已经准备好了,请帮忙。:) 第一个按钮 <div id="spoiler"> <div> <p style="text-align: center;"><input style="margin: 10px; padding: 0px; width: 150px; font-size: 12px;

伙计们!我的问题是针对IE8(使用IE8第一个按钮可以,但第二个按钮不起作用)、GoogleChrome(第二个按钮可以,但第一个按钮不起作用)优化这段代码。我已经准备好了,请帮忙。:)

第一个按钮

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


这是您代码中的直接引用吗?”因为检查它,我可以立即看到在按钮1 javascript代码中,有一个“在靠近末尾的地方缺少,在
this.value=Show-each?”(应该是
this.value='Show reach?';
)。考虑修复这个问题,看看是否有什么变化。< /P>