我本想做个想win7旗舰版桌面能自动换背景的网页,先是做了一个可是却出问题,求指导
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="Model.WebForm5" %><!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 runat="server">
<title></title>
<script type="text/javascript">
function change() {
document.getElementById("bg").style.backgroundImage = "url(images/show_fengjingta_236621_4.jpg)";
}
setTimeout(change(), 1000)
</script>
</head><body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div id = "bg">
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
<div>
</div>
</html>运行时却说无法找到style值 这是为什么
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5.aspx.cs" Inherits="Model.WebForm5" %><!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 runat="server">
<title></title>
<script type="text/javascript">
function change() {
document.getElementById("bg").style.backgroundImage = "url(images/show_fengjingta_236621_4.jpg)";
}
setTimeout(change(), 1000)
</script>
</head><body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div id = "bg">
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
<div>
</div>
</html>运行时却说无法找到style值 这是为什么
解决方案 »
- 菜鸟求代码,帮帮忙啊,有关页面动态刷新的。(刚才那贴404了,重发)
- 每次点击都会有一次请求请问怎么改
- 按钮控制半透明层(窗体最顶,不是页面最顶) 淡入淡出效果 怎么做?
- 提示缺少对象怎么回事?
- 判断文本框过长的JAVASCRIPT的语句
- 送分:获取3个单行文本框的字符串,通过1个按钮输出结果!
- <script>里面有退出或是return吗?可以这么用吗?
- 正则表达式问题
- 用javascript如何修改注册表:
- 如何使用Javascript全屏打开窗口
- js中setTimeout和setInterval工作原理有什么区别吗?
- 在google和火狐中用jquery获取颜色为rgb,怎么转换成为#CCDDFF这种颜色呢
function change() {
document.getElementById("bg").style.backgroundImage = "url(images/show_fengjingta_236621_4.jpg)";
}
window.onload = function(){
setTimeout(change(), 1000)
}
setTimeout(change, 1000); //去掉()后在FF和IE6都可以执行。
window.onload = function(){
setTimeout(change, 1000);
}不然要是1秒后div还是没有加载到,还是会报错