怎样利用JavaScript实现点击按钮后改变按钮的背景图片
要求实现:点击一次改变一次(图片不相同)
用不重复随机数控制!!
比如图片为1.jpg 2.jpg....
C# code:
public static int[] GetRandom2(int minValue, int maxValue, int count)
{
int[] intList = new int[maxValue];
for (int i = 0; i < maxValue; i++)
{
intList[i] = i + minValue;
}
int[] intRet = new int[count];
int n = maxValue;
Random rand = new Random();
for (int i = 0; i < count; i++)
{
int index = rand.Next(0, n);
intRet[i] = intList[index];
intList[index] = intList[--n];
}
return intRet;
}
创建一个backgroundimage css样式。然后改变它。
汗,大哥,能不能写点注释~~~
我是菜鸟,不要怪~~·
<input type=button style='background-image(url(a.gif))' onmouseover="this.style.backgroundImage='url(b.gif)'" onmouseout='this.style.backgroundImage='url(a.gif)''/>
楼上的已经很详细了
我就不写了
呵呵
onmouseover onmouseout
改变背景图片
{{---
相关问答:
三个数x,y,z 比大小..
var x,y,z,t;
if (x>y)
{t=x;x=y;y=t;} //交换x,y的值
if(x>z)
{t=z;z=x;x=t;}//交换x,z的值
if(y>z)
{t=y;y=z;z=t;}//交换z,y的值
这是 ......
怎么才能判断键盘是否被按下和松开。。。。。不知道怎么判断。。。谁能告诉我下吗。。。。谢谢
onkeydown和onkeyup事件
引用
onkeydown和onkeyup事件
自动触发这两个事件
onkeydown 按下
onkeyup 松开
......
有朋友可以帮下忙。想达到一个显示的效果。 得需要搜索什么资料。问题是这样的
有一个网页导航,鼠标点击以后页面不跳转,直接在页面里显示 导航的子菜单,然后鼠标放在子菜单的某个目录上,用AJAX弹出数据库的内容 ......
在网上找到的源码,可是执行不了,请前辈们看看,
执行+-*/是可以的
C# code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.CodeDom.Comp ......
例:
<table width="100%" align="center" id="mytbl" border="0" bgcolor="#EEEEEE">
<tr>
<td class ......