ITeye博客

平民王子

平民王子 · 共 187 篇文章

Prototype中使用Event和Template

Prototype中使用Event的一个简单的例子: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>使用Event</title> <meta name="author" content="Yeeku.H.Lee" /> <meta name="website" content="h…

2010-11-20 22:40 · Prototype · 评论(0) · HTML · prototype · JavaScript · XHTML

Prototype使用Form操作表单和使用Hash对象

先看使用Form操作表单: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Form元素</title> <meta name="author" content="Yeeku.H.Lee" /> <meta name="website" content="http://www.craz…

2010-11-20 22:36 · Prototype · 评论(0) · Ajax · JavaEE · prototype · JavaScript · XHTML

Prototype中使用ObjectRange和Form.Element操作表单

先看ObjectRange的应用: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ObjectRange</title> <meta name="author" content="Yeeku.H.Lee" /> <meta name="website" content="http:/…

2010-11-20 22:33 · Prototype · 评论(0) · HTML · Ajax · prototype · JavaScript · XHTML

Prototype中使用Enumerable

下面是each()方法的遍历示范 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>使用Enumerable</title> <meta name="author" content="Yeeku.H.Lee" /> <meta name="website" content="http:/…

2010-11-20 22:30 · Prototype · 评论(0) · HTML · prototype · JavaScript · XHTML

Prototype中使用Element对象

增加CSS样式 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>使用Element对象</title> <meta name="author" content="Yeeku.H.Lee" /> <meta name="website" content="http://www.crazy…

2010-11-20 22:28 · Prototype · 评论(0) · HTML · CSS · prototype · JavaScript · XHTML

Prototype支持JSON

JSON格式的数据具有轻量级,易懂,跨语言的优势,Prototype库的JSON支持Date,Object,Array,Hash,Number类增加里toJSON()方法。 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JSON支持</title> <meta name="autho…

2010-11-20 22:22 · Prototype · 评论(0) · Ajax · json · prototype · JavaScript · XHTML

Prototype的简单介绍

Prototype只是一个JavaScript库, 可到 http://www.prototypejs.org/download 站点去下载最新版本,点击连接“目标另存为”就可以了。使用它很简单copy到项目中,然后: <script type="text/javascript" src="js/prototype-1.6.0.3.js"></script> 第一个简单的Prototype程序: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getCo…

2010-11-20 22:19 · Prototype · 评论(0) · HTML · Cache · prototype · JavaScript · XHTML

一个简单的Ajax程序XMLHttpRequest

XMLHttpRequest是Ajax的灵魂,Ajax技术的核心就是异步放松请求,而XMLHttpRequest则是异步放松请求的对象。 下面就是一个简单的Ajax程序: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+…

2010-11-19 22:44 · Ajax · 评论(0) · Cache · Ajax · JSP · JavaScript · Servlet

JS日历选择插件三

JS代码 `var Calendar = function( instanceId, language, startYear, endYear ){ if( typeof instanceId == "string" ){ this.Date = new Date(); this.Year = this.Date.getFullYear(); this.Month = this.Date.getMonth(); this.Week = this.Date.getDay(); this.Today = this.Date.getDate(); this.InstanceId = instanc…

2010-11-19 15:19 · JS · 评论(0) · CSS · J# · UP · prototype · JavaScript

JS日历选择插件二

JS代码 `var Calendar = function( instanceId, language, startYear, endYear ){ if( typeof instanceId == "string" ){ this.Date = new Date(); this.Year = this.Date.getFullYear(); this.Month = this.Date.getMonth(); this.Week = this.Date.getDay(); this.Today = this.Date.getDate(); this.InstanceId = instanc…

2010-11-19 15:17 · JS · 评论(0) · CSS · J# · prototype · JavaScript · IE

JS日历选择插件一

js代码 `function Calendar(beginYear, endYear, language, patternDelimiter, date2StringPattern, string2DatePattern) { this.beginYear = beginYear || 1980; this.endYear = endYear || 2020; this.language = language || 0; this.patternDelimiter = patternDelimiter || "-"; this.date2StringPattern = date2String…

2010-11-19 15:14 · JS · 评论(0) · HTML · Cache · prototype · JavaScript · SUN

JavaScript写的一个简单的可拖动效果

先看js代码 function drag(target, event) { // 定义开始拖动时的鼠标位置(相对window座标) var startX = event.clientX; var startY = event.clientY; //定义将要被拖动元素的位置(相对于document座标) //因为该target的position为absolutely,所以我们认为它的基于的座标系是document var origX = target.offsetLeft; var origY = target.offsetTop; //因为后面根据event的clientX、clientY来…

2010-11-19 14:52 · JS · 评论(0) · Cache · 浏览器 · Windows · JavaScript · IE

JS写的一个简单的JavaScript树

先看下效果 下面就是JS代码 function clickHandler() { //定义需要操作的XHTML元素id var targetId; //定义需要被操作的XHTML元素 var targetElement; //定触发事件的事件源(其中event是隐式可用的全局对象) var srcElement = event.srcElement; //根据其className属性值判断它不是叶子节点,即该节点可以展开 if (srcElement.className.substr(0,7) == "outline") { //如果事件源是树节点前的图片 if (srcElement.id…

2010-11-19 14:50 · JS · 评论(0) · HTML · CSS · JavaScript · XHTML

DOM解析XML

import java.io.IOException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.sun.org.apache.xerces.internal.impl.xs.dom.DOMParser; public class DOMParserTest { public static void main(String[] …

2010-11-17 16:44 · DOM模型 · 评论(0) · Ajax · Spring · Struts · XML · Hibernate

DOM模型动态增加element

为列表框,下拉菜单增加选项 <%@ 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"> …

2010-11-17 16:43 · DOM模型 · 评论(0) · HTML · Cache · JavaScript