posts - 6, comments - 6, trackbacks - 0, articles - 0

2007年4月23日

<!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>
<script type="text/javascript">
/* Create a new XMLHttpRequest object to talk to the Web server */
function getbw()
{
    var xmlhttp;
 try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  } catch (oc) {
   xmlhttp=null;
  }
 }
 if(!xmlhttp && typeof XMLHttpRequest != "undefined")
  xmlhttp = new XMLHttpRequest();
return xmlhttp;
}
 
    function IDRequest(n) {
 xmlhttp=getbw();
    //定义收到服务器的响应后需要执行的JavaScript函数
    url=n+document.getElementById('163id').value;//定义网址参数
    alert(url);
 xmlhttp.open("GET",url, true);       
 xmlhttp.send(null);        
    //xmlhttp_request=getXMLRequester();//调用创建XMLHttpRequest的函数       
    xmlhttp.onreadystatechange = doContents;//调用doContents函数       

    }   
    function doContents() {       
    if (xmlhttp.readyState == 4) {// 收到完整的服务器响应           
        if (xmlhttp.status == 200) {//HTTP服务器响应的值OK
  
       document.getElementById('message').innerHTML = xmlhttp.responseText;//将服务器返回的字符串写到页面中ID为message的区域           
        } else {               
        alert(xmlhttp.status);
        }       
        }   
        }
        </script>
</head>
<body>
<input type="text" id="163id" />
<input type="button" value="校验" onclick="IDRequest('check.php?userid=')" />
<div id="message"></div>
</body>
</html>

posted @ 2007-04-23 19:10 吴涛涛 阅读(376) | 评论 (0)编辑 收藏

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>javascript生成上传图像预览功能</title>
</head>
<body>
<INPUT id=photo1 style="WIDTH: 350px"   onpropertychange="if(event.propertyName=='value') preview1.src=photo1.value.replace(/\\/g,'/')"
            type=file name=photo1>
<br />
<IMG id=preview1 height=66 src="图片博客-上传图片_files/sampe3.jpg"
width=66 name=preview1>
</body>
</html>

posted @ 2007-04-23 19:09 吴涛涛 阅读(425) | 评论 (0)编辑 收藏