兼容多种浏览器的JavaScript

1、

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>JS Test</title>
<script type="text/javascript">
	function show(event){
		var x,y;
		if(window.event){
			event=window.event;
			x=event.clientX;
			y=event.clientY;
		}else{
			x=event.pageX;
			y=event.pageY;
		}
		var flow=document.getElementById("flow");
		flow.style.display="block";
	}

	function hide(event){
		var x,y;
		if(window.event){
			event=window.event;
			x=event.clientX;
			y=event.clientY;
		}else{
			x=event.pageX;
			y=event.pageY;
		}
		var flow=document.getElementById("flow");
		flow.style.display="none";
	}
</script>
<style type="text/css">
	#flow{
		display:none;
		width:180px;
		height:100px;
		background-color:#DDEDFB;
	}
</style>
</head>
<body>
	<button onmouseover="show(event)" onmouseout="hide(event)">Test</button>
	<div id="flow"></div>
</body>
</html>

 

你可能感兴趣的:(JavaScript,html,浏览器,css)