js 事件 通过内部style改变背景色(一)
2014-01-21 16:17
330 查看
<html> <head> <script> /*function test1(){ //window.alert("ok!"); } function test2(e){ //window.alert("x = "+e.clientX+" y = "+e.clientY); } */ function test3(){ var date = new Date(); window.alert(date.toLocaleString()); } function change(eobj){ var mysty = document.getElementById("mystyle"); if(eobj.value == "blue"){ //window.alert("OK"); mysty.style.backgroundColor = "blue"; }else{ mysty.style.backgroundColor = "pink"; } } </script> </head> <body> <input type = "button" value="当前时间" onclick = "test3()"/> <div id = "mystyle" style = "width:400px;height:300px;background-color:pink"> div1 </div> <input type = "button" value="pink" onclick = "change(this)"/> <input type = "button" value="blue" onclick = "change(this)"/> </body> </html>
相关文章推荐
- js使用正则表达式
- js判断参数是否为非数字
- JSP编译指令page、include详解
- javascript汉字转拼音的方法
- JSTL标签库动态生成表格
- 代码段-JS路由
- javascript: 字符串拼接有问题
- js添加、修改、删除xml节点例子
- javascript 函数参数之中的undefined(zz)
- 利用C#实体克隆一个js实体
- (转)Silverlight 与 JS交互
- JS自调用匿名函数 self-invoking anonymous function
- JavaScript垃圾回收、闭包、作用域
- jsonp客户端调用示例
- js 将json字符串转换为json兑现
- 转: ajax跨域之JSONP
- 移动开发框架,第【一】弹:QuoJs 官方文档(汉化版)
- Windows CE /SmartDeviceProject 操作Json数据实现对象序列化和反序列化
- extjs进度条设置
- javascript 匿名函数的理解,js括号中括function 如(function(){})