菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> <style type="text/css"> img{ position:absolute; top:100px; } </style> <script> function clipImage(){ document.getElementById("img1").style.clip="rect(0px 75px 75px 0px)"; } function clearClip(){ document.getElementById("img1").style.clip="auto"; } </script> </head> <body> <img id="img1" src="w3javascript.gif" width="100" height="132"> <input type="button" onclick=clipImage() value="裁剪图片"> <input type="button" onclick=clearClip() value="不裁剪图片"> </body> </html>
运行结果