运用XMLHttpRequest 实现移动鼠标出现不同的登录界面
使用XMLHttpRequest 实现移动鼠标出现不同的登录界面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>鼠标移动</title> <script> var xmlHttp; function over(){ xmlHttp=new XMLHttpRequest(); xmlHttp.open("GET","test2.jsp",true); xmlHttp.send(null); xmlHttp.onreadystatechange=stateChanged; } function over1(){ xmlHttp=new XMLHttpRequest(); xmlHttp.open("GET","test6.jsp",true); xmlHttp.send(null); xmlHttp.onreadystatechange=stateChanged; } function stateChanged(){ if(xmlHttp.readyState==4){ document.getElementById("id2").innerHTML =xmlHttp.responseText; } } </script> </head> <body> <table border="1"> <tr><td> <h1 onmouseover="over()">用户登录</h1> </td><td> <h1 onmouseover="over1()">管理员登录</h1> </td> </tr> <tr><td colspan="2"> <div id="id2"> 用户名:<input type="text" size="20"/> <br> 密码: <input type="password" size="21"/> </div> </td></tr> </table> </body> </html>