简单的颜色查看页面代码——基于DOM的实现
2007-05-25 13:04
405 查看
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
<!--
function go(){
var colorValue = document.getElementById("colorInput").getAttribute("value",0);
var displaySpanStyle = document.getElementById("displaySpan").getAttribute("style",0);
displaySpanStyle.setAttribute("backgroundColor",colorValue,0);
}
-->
</script>
</head>
<body>
<input type="text" id="colorInput" />
<button onclick="javascript:go();">确定</button>
<span id="displaySpan" style="width:50pt;height:10pt;background-color:red;"></span>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
<!--
function go(){
var colorValue = document.getElementById("colorInput").getAttribute("value",0);
var displaySpanStyle = document.getElementById("displaySpan").getAttribute("style",0);
displaySpanStyle.setAttribute("backgroundColor",colorValue,0);
}
-->
</script>
</head>
<body>
<input type="text" id="colorInput" />
<button onclick="javascript:go();">确定</button>
<span id="displaySpan" style="width:50pt;height:10pt;background-color:red;"></span>
</body>
</html>
相关文章推荐
- AJAX实现简单的注册页面异步请求实例代码
- 基于C中一个行压缩图的简单实现代码
- 基于jQuery实现Div窗口震动特效代码-代码简单
- 基于jquery的设置页面文本框 只能输入数字的实现代码
- 100行代码实现最简单的基于FFMPEG+SDL的视频播放器
- Android基于广播事件机制实现简单定时提醒功能代码
- JS基于ocanvas插件实现的简单画板效果代码(附demo源码下载)
- 一个简单的AJAX实现,基于C#的ASP.Net,包括服务器端的程序代码
- [导入]AjaxPanel自定义控件实现页面无刷新数据交互(做了个示例程序, 效果确实比较Cool, 用法非常简单! )(示例代码下载)
- 100行代码实现最简单的基于FFMPEG+SDL的视频播放器
- 用JavaCV改写“100行代码实现最简单的基于FFMPEG+SDL的视频播放器 ”
- 基于jQuery实现Div窗口震动特效代码-代码简单
- 基于jquery的让页面控件不可用的实现代码
- AjaxPanel自定义控件实现页面无刷新数据交互(做了个示例程序, 效果确实比较Cool, 用法非常简单! )(示例代码下载)
- 100行代码实现最简单的基于FFMPEG+SDL的视频播放器(SDL1.x)
- JavaScript基于DOM操作实现简单的数学运算功能示例
- 简单的asp.net模拟邮箱系统基础实现(二 (2)具体版块功能的实现及关键代码之登陆页面)