日期:2014-05-16 浏览次数:20319 次
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? <head>
? <script type="text/javascript">
??? function fasong(){
????? //var content=document.getElementById("content").value;
????? var content=$("#content").val();
????? var content1=document.getElementById("content").value;
????? //alert(content);
????? if(content==""){
?? // alert("11111111");
?? //$("#msg").show();
????? document.getElementById("msg").style.display="block";
????? $("#errormsg").show();
????? document.getElementById("errormsg").innerHTML="请输入内容";
????? }else{
???? //$("#msg").hide();
?????
?????
????? document.getElementById("msg").style.display="none";
???? $("#errormsg").hide();
????? //$("#message").html(content);
????? document.getElementById("message").innerHTML=content;
?????????? }
?????
??? }
???
?? function check(){
???? var content=$("#content").val();
???? if(content!=""){
?????? $("#msg").hide();
?????? $("#errormsg").hide();
?????? document.getElementById("message").innerHTML=content;
???? }else{
?????? $("#msg").show();
?????? $("#errormsg").show();
?????? document.getElementById("errormsg").innerHTML="请输入内容";
?????? document.getElementById("message").innerHTML=content;
???? }
?? }
? </script>
???
??? <title>My JSP 'Ajax.jsp' starting page</title>
??? <script type="text/javascript" src="js/jquery-1.4.min.js"></script>
? </head>
?
? <body>
?
?? <div id="message" style="height:80px;border:1px solid red;"></div>
?? <table style="border:0">
???? <tr>
??????? <td><input type="text" name="neirong" id="content" ondblclick="check()"/></td><td style="display:none" id="msg"><div id="errormsg" style="color:red;font-size:12px;display:none;"></div></td><td><div onclick="fasong()" style="cursor:pointer;background-color:#0fe">发送</div></td>
???? </tr>
????
?? </table>
??
?
? </body>
</html>
?