在javascript文件中使用jstl标签
今天看到同事harry_duan写的一个js文件,感觉挺有意思。
目地是在js文件中使用jstl的fmt:message
1.在资源文件中定义消息 errors.message1=error xxxxxx
2.创建一个js文件,为了jstl能用,将js文件命名为 myjs.js.jsp (以jsp结尾)
js 代码
<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
showMessage = function() {
alert("<fmt:message key="errors.message1"></fmt:message>");
}
3.在jsp中引用这个js文件
xml 代码
<script type="text/javascript" src="js/myjs.js.jsp">script>
<input type="button" onclick="javascript: showMessage();" value="showMessage">
这样就OK了
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
<html>
<head>
<script type="text/javascript">
function goHome(){
  ......
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return ......
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="re ......
/**
* CSSClass.js
*/
var CSSClass = {}; //Create our namespace object
//Return tru if element e is a member of the class c;false otherwise
CSSClass.is = fucntion(e, c)
{
if(typeof e == "string")
e = document.getElementById(e);
//Before doing a regexp search,optimize for couple of co ......