<script language=JavaScript>
var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",50);
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
function disableRightClick(e)
{
var message = "";
if(!document.rightClickDisabled) // initialize
{
if(document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = disableRightClick;
}
else document.oncontextmenu = disableRightClick;
return document.rightClickDisabled = true;
}
if(document.layers || (document.getElementById && !document.all))
{
if (e.which==2||e.which==3)
{
alert(message);
return false;
}
}
else
{
alert(message);
return false;
}
}
disableRightClick();
function get_info(tag_name,url){
document.getElementById(tag_name).innerHTML ="正在加载数据...";
var callback = processAjaxResponse(tag_name);
executeXhr(callback,url);
}
function executeXhr(callback,url) {
//var url = "response_page.asp?username=测试&r="+ Math.random();
//var queryString = "password="+encodeURI(encodeURI("测试2"))+"&test=测试2"
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.open("GET", url, true);
//req.setRequestHeader("Content-Type","text/html");
//req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
req.onreadystatechange = callback;
req.send(null);
} // branch for IE/Windows ActiveX version
else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.open("GET", url, true);
// req.setRequestHeader("Content-Type","text/html");
//req.setRequestHeader("Content-Type","gb2312");
// alert();
//req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=GB2312');
req.onreadystatechange = callback;
req.send(null);
}
}
}
function processAjaxResponse(tag_name) {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
//alert(req.responseText);
//var str=new String(req.responseText);
var str;
alert(req.responsetext);
// document.getElementById(tag_name).innerHTML =req.responsetext;
}else {
}
}
}
function out_info(str)
{
alert(str);
window.reload();
}
function gethits(hits)//更新点击次数
{
//alert(hits);
document.getElementById('view_hits').innerHTML=hits;
}
function view_info(id_str,htmls)//更新动态数据
{
document.getElementById(id_str).innerHTML=htmls;
}
function init()
{
document.getElementById('hits').src='hits.asp?id=<$%=id%$>';
document.getElementById('ad').innerHTML=document.getElementById('ad2').innerHTML
get_info();
}
</script>
[[it] 本帖最后由 chenxingg 于 2008-9-3 14:57 编辑 [/it]]