js为什么这样写点击一次会变,再点击就不会变换了呢,
<input type="button" value="切换" onClick="showHideo()" class="touch_sr_only"/>
<div id="div1"></div>
<script>
function showHideo()
{
var eDiv=document.getElementById('div1');
if(eDiv.style.cssText=='top:100px;background:#f60')
{
eDiv.style.cssText='top:0px;background:#fff';
}
else
{
eDiv.style.cssText='top:100px;background:#f60';
}
}
</script>
<style>
#div1 { position:relative; width:100px; height:100px; background:#CCC; top:0;}
</style>