js调用js的函数和HTML事件调用js函数的不一样之处

js在调用js函数的时候,函数名后不可以带有圆括号,HTML标签在调用js函数的时候须要有圆括号。javascript

<html>
	<head>
		<title>My First Script</title>
		<style type="text/css">
			.highlight{color:red;}
		</style>
		<script type="text/javascript">
			function showBrowserType(){
				document.getElementById("readout").innerHTML="<span class='highlight'>Your Browser Says it is:"+navigator.userAgent+"</span>.<hr />";
			}
			//window.onload=showBrowserType;
		</script>
	</head>
	<body>
		<h1>Let's Script...</h1>
		<hr />
		<div id="readout"></div>
		<input type="button" id="btn" value="click" onclick="showBrowserType()"/>
	</body>
</html>
相关文章
相关标签/搜索