日期:2014-05-16 浏览次数:20980 次
<script>
var $=function(id){ return document.getElementById(id); }
window.onload=function(){
var imgURL=$("img1").src;
var id=imgURL.split("?id=")[1];
$("img1").src="http://www.2.com/"+id+"/sample.jpg;
$("img1").classText="display:''";
}
</script>
<img id=img1 src="http://www.sample.com/sample.asp?id=1" style="display:none" />
<%
id=request.QueryString("id")
if id="" then id=-1;
'假设http://www.2.com/ 是你放图片的网站,注意把图片路径写正确
if id<0 then
imgUrl="http://www.2.com/alt.jpg"'当解析错误时,一张替换图片的地址
else
imgUrl="http://www.2.com/"&id&"/sample.jpg"'真正的图片地址
'计数:
'sql="UPDATE [计数表] SET [计数字段]=[计数字段]+1 WHERE imgID="&id
conn.execute(sql)
conn.close()
end if
Response.Status="301 Moved Permanently"'声明转向状态为301
Response.AddHeader "Location",imgUrl '跳转
Response.End()
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> test </title>
</head>
<body>
<img src="http://www.sample.com/sample.asp?id=1" alt='id=1'">
<img src="http://www.sample.com/sample.asp?id=2" alt='id=2'">
</body>
</html>