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

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -