`

HTML/jsp/js(jquery)

 
阅读更多
 html/jsp/js/jquery

1. html 为静态页面,浏览器解析(也就是说不需要打开服务器就能执行) 不能写java代码

2. jsp为动态页面,web容器解析(也就是说必须要打开服务器才能运行) 可以写java代码

3. js 代码存在于html中, js控制web行为,html 控制web结构

js:

<!DOCTYPE html>
<html>

<head>
<script>
function myFunction()
{
document.getElementById("demo").innerHTML="My First JavaScript Function";
}
</script>
</head>

<body>

<h1>My Web Page</h1>

<p id="demo">A Paragraph</p>

<button type="button" onclick="myFunction()">Try it</button>

</body>
</html>

 jquery:

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("p").click(function(){
  $(this).hide();
  });
});
</script>
</head>

<body>
<p>If you click on me, I will disappear.</p>
</body>

</html> 

 

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
</head>

 

jsp:
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics