Javascript技巧大集合3
Javascript技巧大集合3
171.设置和使用cookie
<HTML>
<BODY>
设置与读取 cookies...<BR>
写入cookie的值<input type=text name=gg>
<INPUT TYPE = BUTTON Value = "设置cookie" onClick = "Set()">
<INPUT TYPE = BUTTON Value = "读取cookie" onClick = "Get()"><BR>
<INPUT TYPE = TEXT NAME = Textbox>
</BODY>
<SCRIPT LANGUAGE="JavaScript">
function Set()
{
var Then = new Date()
Then.setTime(Then.getTime() + 60*1000 ) //60秒
document.cookie = "Cookie1="+gg.value+";expires="+ Then.toGMTString()
}
function Get()
{
var cookieString = new String(document.cookie)
var cookieHeader = "Cookie1="
var beginPosition = cookieString.indexOf(cookieHeader)
if (beginPosition != -1)
{
document.all.Textbox.value = cookieString.substring(beginPosition + cookieHeader.length)
}
else
document.all.Textbox.value = "Cookie 未找到!"
}
</SCRIPT>
</HTML>//
172.取月的最后一天
function getLastDay(year,month)
{
//取年
var new_year = year;
//取到下一个月的第一天,注意这里传入的month是从1~12
var new_month = month++;
//如果当前是12月,则转至下一年
if(month>12)
{
new_month -=12;
new_year++;
}
var new_date = new Date(new_year,new_month,1);
return (new Date(new_date.getTime()-1000*60*60*24)).getDate();
}//
173.判断当前的焦点是组中的哪一个
for(var i=0;i<3;i++)
if(event.srcElement==bb[i])
break;//
174.实现类
package com.baosight.view.utils;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.http.HttpSession;
public class Mytag extends TagSupport
{
public int doStartTag() throws javax.servlet.jsp.JspException
{
boolean canAccess = false;
HttpSession session= pageContext.getSession();
if (canAccess)
{
return EVAL_BODY_INCLUDE;
}
else
{
return this.SKIP_BODY;
}
}
}
175.在web.xml中添加定义
<taglib>
<taglib-uri>guoguo</taglib-uri>
<taglib-location>/WEB-INF/abc.tld</taglib-location>
</taglib>
176.标签库中定义abc.tld
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"doc.guandang.net;
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>hr</shortname>
<uri>guoguo</uri>
<info>Extra 3 Tag Library</info>
<tag>
<name>mytag</name>
<tagclass>com.baosight.view.utils.Mytag</tagclass>
<attribute>
<name>id2</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
177.在使用自定义标签的页面中加入自己定义的标签,
<%@ taglib uri="guoguo" prefix="guoguo" %>
//自己定义标签
178.显示带边框的集
<fieldset style="border:1px gray solid;width:100px">
<legend>查询条件</legend>
dfdfdf
</fieldset>//
179.【文件(F)】菜单中的命令的实现
1、〖打开〗命令的实现
[格式]:document.execC
Javascript 技巧大集合 程序员部落 花开花落 发表于 2008-10-18 00:27 Javascript 技巧大集合 1.文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当...
Javascript 技巧大集合时间 1.文本框焦点问题 文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当输入获得焦点后,产生该文件 Onchange:当文字值改变时,...
Javascript技巧大集合 1.文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当输入获得焦点后,产生该文件 Onchange:当文字值改变时,产生该事件 Onselect:当...
javascript使用技巧大全javascript使用技巧大全隐藏>> Javascript技巧大集合 [日期:2008-07-04] 来源: 作者: [字体:大中小] 1.文本框焦点问题 onBlur:当失去输入...
各种常用JS脚本 92页 免费 javascript教程 25页 免费 JavaScript技巧200例 44页 2财富值 Javascript技巧大全 100页 免费 JavaScript实现功能全集 6页 免费...
Javascript技巧大全 100页 免费 JavaScript方法大全 8页 1财富值 Javascript 技巧大全 14页 1财富值 JavaScript常见方法大全 21页 2财富值 Javascript 方法大全 3...
JavaScript使用方法和技巧大全_IT/计算机_专业资料。JavaScript使用方法和技巧大全有些时候你精通一门语言, 但是会发现你其实整天在和其它语言打交道, 也许你以为这些...
http://www.55like.com 专业的网站建设与定制 作者: 边城浪子 经典 Javascript 技巧大全 1.文本框焦点问题 onBlur:当失去输入焦点后产生该事件 onFocus:当输入...
javascript技巧集合_IT/计算机_专业资料。javascript技巧集合javascript 技巧集合(续……) 技巧集合( ) 1. oncontextmenu="window.event.returnValue=false" 将...
javascript方法和技巧大全_javascript教程_IT/计算机_专业资料。把有关JavaScript的方法和技巧整理下,让每个在为JavaScript而烦恼的人明白,JavaScript就这么回事!并希望...
热门文档