ASP.NET使用模板页 Body onload事件

来源:互联网 发布:上海市区供电公司知乎 编辑:程序博客网 时间:2024/05/18 00:35

ASP.NET使用模板页 Body onload事件

在使用ASP.NET 模板页的时候,有一个问题,就是onload事件只有一个。
但有时候可能需要针对某几个页需要不同的onload事件
解决方法:
js:
在需要的页面里设置js onload事件一个函数在加载时就会执行这个函数..
window.onload=function changepic()
{
var flag=parseInt(Math.random()*15)+1;

document.all.culture.src="images/culture/"+flag+".jpg";
document.all.scenery.src="images/scenery/"+flag+".jpg";
document.all.custom.src="images/custom/"+flag+".jpg";
document.all.taste.src="images/taste/"+flag+".jpg";
document.all.realtour.src="images/realtour/"+flag+".jpg";
}