例一:文字变化(男女)
<input name="text2" type="text" onClick="return Zc()" value="男" size="7">
。。。。。。。
<script language="javascript">
function Zc() {
if (form1.text2.value=="男" )
form1.text2.value="女"
else
form1.text2.value="男"
}
</script>
例二:单击滚屏
<script language="JavaScript">
var currentpos,timer,x;
function initialize()
{
if (x==1 )
{
x=0
sc();
}
else
{
x=1
timer=setInterval("scrollwindow()",40);
}
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onclick=initialize
</script>
例三:图片放大,缩小。
<input NAME="images1" TYPE="image" ID="images1" ALIGN="MIDDLE" src="Images/图片处理.jpg" onClick="expand111()">
。。。。。。。
<script language="javascript">
var height = images1.height;
var y;
function expand111()
{
if ( y==1)
{
for(x = 0; x<200; x++)
{
images1.height = images1.height-1;
}
y=0;
}
else
{
for(x = 0; x<200; x++)
{
images1.height = images1.height+1;
}
y=1;
}
}
</script>
|