- 博客(141)
- 资源 (1)
- 收藏
- 关注
转载 利用初始化方法创建对象
Using object initializersSome Page The following example creates myHonda with three properties. Note that the engine property is also an object with its own properties. var myHonda =
2013-05-31 05:04:05 433
转载 先定义元素,然后再使用
Some Page document.getElementById("foo").onclick = function() { alert("Hello world!"); } document.getElementById("shabi").onclick = function() { alert("You can not use the elemen
2013-05-31 04:31:11 459
转载 JavaScript定义函数的方式
var hello = function(who) { alert("Hello, " + who + "!"); };Some Page hello("biu"); hello.call(window, "you"); 写在body中,页面加载就被调用!原文:http://en.wikibooks.org/wiki/JavaScript/Functions_
2013-05-31 03:27:59 448
转载 用prototype继承整个对象
what if we want to inherit an entire object?Some Page // Declare two objects - we're going to want Lion to // inherit from cat function cat() { this.eyes = 2; this.legs = 4; t
2013-05-31 03:13:51 411
转载 到底谁是this
What the fuck is this?Some Page In this example,"this" is the number you put in there,or the container! <input type="text" name="age" size="3" onChange="validate(this, 18, 99)"> func
2013-05-31 02:39:23 545
转载 用2个点操作符一步步延伸自定义对象
大开眼界的例子,using two dot operator to develop custom object.Some Page var triangle = new Object(); triangle.getArea=function(){ return "let's try two dot!"; }; //the above is li
2013-05-31 02:26:48 512
原创 把整个函数的源代码都传进来了
alert的我O,my God. 这不科学。 var net = new Object(); function deal_online() { var sysBBS = "欢迎光临心之语聊天室,请遵守聊天室规则,不要使用不文明用语。"; return sysBBS; } net.AjaxRequest = function(onload) { this.onloa
2013-05-30 19:21:22 490
转载 用call调用匿名函数
function zou() { var animals = [ { species : 'Lion', name : 'King' }, { species : 'Whale', name : 'Fail' } ]; for ( var i = 0; i < animals.length; i++) { (function(i) { this.print =
2013-05-30 06:13:57 854
转载 函数apply和call的简单例子
Function.apply and Function.call in JavaScriptThe apply() method is identical to call(), except apply() requires an array as the second parameter. The array represents the arguments for the target m
2013-05-30 05:27:03 506
转载 JavaScript call函数的用法
fuckUveryMuch.call(fuckObj, args...)表示调用这个fuckUveryMuch,fuckObj替代fuckUveryMuch这个函数中所出现的thisIn addition to accepting an object as a parameter to replace the called function’s this, it also accepts
2013-05-30 04:33:31 506
转载 XMLHttpRequest().open()打开文本文件
function loadXMLDoc(){var xmlhttp;if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new Activ
2013-05-30 03:09:34 4259
转载 onkeypress
function addEventsToHTML() { var field1 = document.getElementById('field1'); var field2 = document.getElementById('field2'); field1.onkeypress = monitor; field2.onkeypress = monitor; function mon
2013-05-29 21:39:50 442
转载 JavaScript事件onkeypress
function myFunction(){alert("You pressed a key inside the input field");}A function is triggered when the user is pressing a key in the input field.原文:http://www.w3schools.com/jsref/tryit
2013-05-29 20:50:49 533
转载 JavaScript的函数与对象是一回事
function Color(r, g, b) { this.Red = r; this.Green = g; this.Blue = b;}myColor = new Color(10, 20, 30);// Prints out: "Red: 10"alert("Red: " + myColor.Red);testaaaa原文:http://tech.pro/t
2013-05-29 20:28:05 402
原创 prototype继承
String.prototype.trim = function() { return "哈哈";};alert("$4 eee ha Yi 表 ".trim());testaaaa
2013-05-29 20:14:42 445
转载 JavaScript带方法的构造函数
function zou() { // define some methods to be included in Rectangle object function Rectangle_area() { return this.width * this.height; } function Rectangle_perimeter() { return 2 * (this.widt
2013-05-29 19:23:39 488
原创 JavaSrcript对象的构造函数
function zou() { function Rabbit() { } ; var rabbit = new Rabbit(); alert(rabbit.constructor == Rabbit); // true function myObject(what) { this.iAm = what; this.whatAmI = function(language)
2013-05-29 18:53:10 648
原创 JSTL获得网页请求参数以及session属性
走<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>西安Java培训 <% String temp = request.getParameter("liulixin"); out.println(temp); out.println("");
2013-05-29 11:48:00 771
原创 application对象
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>西安小升初 <% String sourceMessage="西安Gava not Java 培训"; application.setAttribute("message",sourceMessage);
2013-05-29 10:20:39 436
原创 设置登录时间session属性
一直对会话心存敬畏,不知道它到底为何物!<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>西安小升初 <% out.println(3 + 5); session.setAttribute("shijian", new Date().toLoca
2013-05-29 09:49:13 864
转载 竖直单选按钮
list.jsp NewFile.jsp package net.liulixin;import java.util.ArrayList;import java.util.List;import com.opensymphony.xwork2.ActionSupport;public class ListAction extends ActionSuppo
2013-05-28 19:08:25 703
转载 用struts2提取一个表中的所有记录
在普通类中,把读出的一条一条的记录放到一个list中,然后再在jsp中用迭代器iterator读出list的内容。治理了中文乱码,mysql和tomcat都是默认值的安装,没做任何字符集的特殊设置。<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>西安
2013-05-28 18:09:27 480
转载 struts2读mysql
create database if not exists struts2_mysql;use struts2_mysql;drop table if exists `user3333`;create table `user3333`(`id` int(11) not null auto_increment,`name` varchar(20) not null,`passwo
2013-05-28 17:38:33 664
转载 struts2的排序sort和子集subset标签
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> 西安小升初Example of Iterator Tag , Employees sorted by Department<s:bean name="com.tutorial
2013-05-28 02:15:05 557
转载 使用OGNL获得session中的值
原文用ActionContext context = ActionContext.getContext();Map session = context.getSession();这样得不到session必须实现SessionAware接口,然后对Map session属性用setter,getter另外,表单中的所有元素都用struts2的标签,然后jsp页面的编码全设置成ut
2013-05-27 23:42:09 1123
转载 用ActionContext.getContext().getValueStack()获得值栈
value stack是一些对象的几何,最后放到这个集合中的元素是:Named ObjectsThese objects include #application, #session, #request, #attr and #parameters and refer to the corresponding servlet scopes以下代码治理了从表单到后台java,再到前台js
2013-05-27 21:43:27 3119
转载 不带自定义类,只有jsp的struts2的例子
这个工程多不需要struts.xml,只需配置web.xml<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>西安小升初18802930979 <% request.setAttribute("foo", "西安Java培训"); %>
2013-05-27 20:24:10 470
转载 OGNL访问集合类数据
在这一讲中,你会学到OGNL表达式语言和访问Java集合类(像Arrays,Lists和Maps)的语法。注意42行到47行,可以用来治理中文乱码。注意60行到65行,太强大了,不但可以用数组的方括号[],还能用方法的圆括号().我走这弯路是被中文乱码搞怕了,把字符串单独拿出来放到temp中,我就可以给它转码了!<%@ page language="java" contentT
2013-05-27 17:52:09 835
转载 把四边形的面积分成相等的2部分
这是2013西安小升初铁一中的一道考题此题的出处请见:http://188029.net/shuxue/g6/tieyi526.html
2013-05-27 00:14:44 1007
转载 到底什么是session
Before going into the details of the HttpSessionBindingListener we should firstly know about the sessions. As we know that Http protocol is a "stateless" protocol. The term stateless means that it can
2013-05-26 01:44:49 521
转载 会话监听以及事件的例子
sessionCreated可以用来记录在线人数package com.java.connect.listener; import javax.servlet.http.HttpSessionEvent;import javax.servlet.http.HttpSessionListener; public class HttpSessionListenerExample impl
2013-05-25 06:11:07 689
转载 调用valueBound方法还不能注册监听器
如果web.xml不注释掉监听器部分:servlet_valueBound <!-- com.listener.HttpSessionBindingListenerExample --> index.jsp 那么运行程序时会出现下面错误:SEVERE: Error configuring application listener of class co
2013-05-25 03:47:23 800
转载 HttpSessionAttributeListener的例子
package com.mkyong;import javax.servlet.http.HttpSessionAttributeListener;import javax.servlet.http.HttpSessionBindingEvent;public class MyAttributeListener implements HttpSessionAttributeListene
2013-05-25 02:09:45 776
转载 iterator的用法
类的写法public String execute() { comboMeals = new ArrayList(); comboMeals.add("小吃 Plate"); comboMeals.add("正餐 Plate"); comboMeals.add("Colonel Chicken 组合"); comboMeals.add("上校汉堡"); combo
2013-05-24 23:53:24 463
原创 注意是在什么方法中初始化的
如果struts.xml这样写 /Success.jsp /Register.jsp 而list是在populate方法中初始化的public String populate() { hobbyList = new ArrayList(); hobbyList.add("棒球"); hobbyList.add("音乐"); hobbyList
2013-05-24 18:28:16 543
翻译 表单元素与普通类的对应属性
你的前端页面如果有 这个,那么你的后台类就应该有 private String yourName;public String getYourName() { return yourName;} public void setYourName(String yourName) { this.yourName = yourName;}注意各处your
2013-05-24 03:41:50 452
转载 去掉字符串的左右空格
去除字符串中的左右空格 function trim(str){ var regExp = /(^\s*)|(\s*$)/g; //验证左右空格的正则表达式 str = str.replace(regExp,""); //去掉字符串的左右空格 return str; } function convert(){ var str = document.getElem
2013-05-24 03:18:53 585
转载 验证年龄字段是否为数字
验证是否为数字 function check(){ var age = document.getElementById("age"); if(age.value==null||age.value==""){ alert("请输入年龄!"); age.focus(); return; } if(isNaN(age.value)){ alert("年龄必
2013-05-24 02:54:03 1067
原创 通过Struts2在视图页面中获得get方法的返回值
public String getLiulixin() { return YES; } public String getNiMaLaGe() { return "骂了隔壁"; } <s:radio label="你喜欢绿蛋 and ham?" name="yourEggsAndHam" list="yesno" value="liulixin" />
2013-05-24 00:13:40 791
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人