html - Javascript onClick Doesnt work on Chrome -
good evening.
i have following code:
<script type="text/javascript"> function action1() { var x = document.getelementbyid('marcagravadapedra'); x.style.display = "inline"; document.getelementbyid('estruturasagrada').style = "display: none;" document.getelementbyid('objectosagrado').style = "display: none;" hideall(); } </script>
and on html itself, have form, , buttons inside it:
<input type="button" id="objectosagradobutton" value="objecto sagrado" onclick="action1();"/>
though, code works on firefox, not on ie or chrome. i've tryed everything, cant seem make work.
that button make divs appear, , others disappear.
<div id="marcagravadapedra">testing1</div>
i can't imagine code work in browser. you've couple of these odd lines overriding style
object string:
document.getelementbyid(...).style = "display: none;"
should be:
document.getelementbyid(...).style.display = "none";
or:
document.getelementbyid(...).setattribute('style', 'display: none');
Comments
Post a Comment