onmouseover,onmouseout javascript not working in google chrome -


onmouseover, onmouseout Javascript is not working in google chrome. The project is working in Mozilla.

  & lt; Script type = "text / javascript" & gt; Function toolmaid (id) {var image = document.getElementById (ID); If (id.style.display == "block") {id.style.display = "none"; } Else {id.style.display = "block"; }} & Lt; / Script & gt; & Lt; Div onmouseover = "Toggle Me ( Two problems in the call on your function, unquoted strings    

Fix this way ...

  & lt; Div onmouseover = "toggleMe ('I & lt;? = $ Id? & Gt;')" ... & lt ;! - Note the quotation ^ ^ - & gt;   

Second, you are using the wrong reference in your function to access the property style it should be the image i.e.

  if (image.style.display == "block") {image.style.display = "none"; } And {image.style.display = "block"; }   

All being said, I use data attributes instead of wire injection in JavaScript functions ...

  & lt; Div data-image = "i & lt;? = $ Id? & Gt;" Onmouseover = "toggleMe (this)" ...   

and function

  function bundle m (trigger) {var image = document.getElementById (trigger. GetAttribute ('image of data')); Image.style.display = image.style.display == 'block'? 'None': 'block'; }    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -