日期:2014-05-16  浏览次数:20400 次

常用javascript实例
/**
* 姚伟男
*/
function high(which2){
theobject=which2;
which2.filters.alpha.opacity=200;
}
function low(which2){
which2.filters.alpha.opacity=40;
}
function changePage(url,frm){
document.getElementById(frm).src=url;
}
function changeText(tab){
document.getElementById(tab).className="textfield";
}
function checkFrm(th){
var  list= document.getElementsByTagName("input");
for(i=0;i<list.length;i++){
var tab=list[i];
if(tab.value==""){
tab.className="textfieldnull";
tab.focus();
return false;}
}
return true;
}
var xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function noLoginWarm() {
window.alert("你还没有登陆,请先登陆在做操作!");
}
function sendMood(){
if(checkFrm(this)){
document.getElementById("sendMood").submit();
}
}
function getMessage(url){
if(checkFrm(this)){
var  list= document.getElementsByTagName("input");
for(i=0;i<list.length;i++){
var tab=list[i];
url+="?"+tab.name+"="+tab.value+"&";
}
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleSatateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
window.location.reload();
}
}
function handleSatateChange(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
document.getElementById("message").innerHTML=xmlHttp.responseText;
}
}
}