package org.elb.util
public class JavaScriptDemo_1 {
public static String getJS(){
return "<script language=\"JavaScript\">alert(\"弹出框\")</script>"
}
}
2:JSP页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>
</head>
<body>
<jsp:useBean id="a" class="org.elb.util.JavaScriptDemo_1"></jsp:useBean>
<%=a.getJS() %>
</body>
</html>
想弹出什么来,就写什么就行了,明白了吗?
用extjs吧,Ext.MessageBox.Warn("修改配置数据会导致系统崩溃,确认继续?",warnModify)实现的就是你这种效果。
你只需要在你的html中引入extjs相关的代码就可以了。
<script language="javascript">
document.write("<link rel=\"stylesheet\" rel=\"text/css\" href=\"../../../ext/resources/css/ext-all-cdn.css?rnd=" + Math.random() + "\"><\/link>")
document.write("<link rel=\"stylesheet\" rel=\"text/css\" href=\"../style/ext-alarm.css?rnd=" + Math.random() + "\"><\/link>")
document.write("<script type=\"text/javascript\" src=\"../../../ext/adapter/ext/ext-base.js?rnd=" + Math.random() + "\"><\/script>")
document.write("<script type=\"text/javascript\" src=\"../../../ext/ext-all.js?rnd=" + Math.random() + "\"><\/script>")
</script>
extjs的包可以官网上下到。