//在本页面操作父页面
opener.location.reload() //上一个页面重新刷新
window.opener.document.getElementById("id").innerHTML=""; //指定上一个页面元素的值
//js 截取页面提交过来的路径地址
var str=document.getElementById("name").value;
document.write(str.substring(str.lastIndexOf("\\")+1))
//-----------------------------------按回车键提交
电话号码:<input type="text" οnkeydοwn="javascript:onkey(event);" style="width:110px"/>
function onkey(e) {
var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
if (keyCode == 13) {
submitIt();
}
}
//--------------------------------------文本框只能填写数字
<input type="text" name="seats" οnkeyup="this.value=this.value.replace(/\D/g,'')" />
// -------------------------------------字符串分隔开后组成一个数组
import java.util.regex.Pattern;
public class test {
public static void main(String[] args) {
String[] x = Pattern.compile(";").split("the;darwinian;devonian;explodian;chicken");
for (int i=0; i<x.length; i++) {
System.out.println(i + " \"" + x[i] + "\"");
}
}
}
//----------------------------------------------HashMap 和Hashtable的应用和区别--------
HashMap : 允许空(null)键值(key),是Hashtable 的轻量级实现(非线程安全的实现)
HashMap 把Hashtable 的contains 方法去掉了,改成containsvalue 和containsKey
最大的区别是: Hashtable 的方法是Synchronize 的,而HashMap 不是
//Hashtable 的应用,取出所有的key和value
Hashtable personTable = new Hashtable();
Set<String> Persons = personTable.keySet();
for (String Person : Persons) {
//System.out.println(Person + "--" + personTable.get(Person));
System.out.println(Person,personTable.get(Person));
}
public static void main(String[] args) {
Hashtable<Integer,String> ht=new Hashtable<Integer,String>();
ht.put(1,"Andy");
ht.put(2,"Bill");
ht.put(3,"Cindy");
ht.put(4,"Dell");
ht.put(5,"Felex");
ht.put(6,"Edinburg");
ht.put(7,"Green");
String str=ht.get(1);
// System.out.println(str);// Andy
Iterator it_key = ht.keySet().iterator();
//对key进行遍历
while (it_key.hasNext()) {
Integer key = (Integer)it_key.next();
System.out.println(key);
}
//对value进行遍历
Iterator it_value = ht.values().iterator();
while (it_value.hasNext()) {
String value =(String) it_value.next();
System.out.println(value);
}
//取出所有的key和value
Set<Integer> its = ht.keySet();
for(int it:its){
System.out.println("it:"+it+":"+"----value:"+ht.get(it));
}
}
//-----------------------------------------------------------------
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String dateString = formatter.format(currentTime);
System.out.println(dateString);
//-------------------------------------游标(for查询)------------------------
declare @CusName varchar(5000)
declare Cursor_Customer Cursor for select CusName from #temp1
open Cursor_Customer
fetch next from Cursor_Customer into @CusName
while @@fetch_status=0
begin
print @CusName
fetch next from Cursor_Customer into @CusName
end
close Cursor_Customer
Deallocate Cursor_Customer
//电脑保护色
色调:84 饱和度:123 亮度: 205
红: 199 绿: 237 蓝: 203
//文本域去掉下拉框和小按钮
<textarea style="font-size:14px;overflow:hidden;background:transparent;border-style:none;width:550px;height:50px;" >textarea>