现在的位置: 首页 > 综合 > 正文

javascript(一)

2013年10月10日 ⁄ 综合 ⁄ 共 694字 ⁄ 字号 评论关闭

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <script type="text/javascript">
        function changeText(){
            var str1=document.getElementById("myDiv");
            str1.innerHTML="hello javascript!";        
        }
    </script>
    <title>index</title>

  </head>
 
  <body>
      <div id="myDiv">
          if you click the button, I will be change
          please do it
      </div>
    <button onclick="changeText();">button</button>
  </body>
</html>

javascript改变页面的内容

抱歉!评论已关闭.