Javascript working in chrome but not in explorer
Posted
by Greg
on Stack Overflow
See other posts from Stack Overflow
or by Greg
Published on 2010-03-26T13:27:04Z
Indexed on
2010/03/26
13:33 UTC
Read the original article
Hit count: 400
Hello,
I am writing this code in html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script>
<title>Welcome to the memory game</title>
</head>
<body>
<h1>Welcome to the memory game!</h1>
<input type="button" name="type" value='Show Layer' onclick="setVisibility('sub3', 'inline');"/>
<input type="button" name="type" value='Hide Layer' onclick="setVisibility('sub3', 'none');"/>
<div id="sub3">Message Box</div>
</body> </html>
It suppose to make the "div" disappear and reapper, but it works in chrome and not in explorer.
Anyone has any idea how can I make it work in explorer (I tried allowing blocked content when that message about activeX appears in explorer)?
Thanks,
Greg
© Stack Overflow or respective owner