易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript 控制css js控制 clss


像上面的一张图片我们该怎么用js 和css + div 很好的应用到我们的项目中呢?
<style>
.InpuRight{
height:20px;background:url(img/msg_bg.png) no-repeat;background-position:0px -250px;
}
.InputError{
width:20px;height:20px;background:url(img/msg_bg.png) no-repeat 0px 0px;
}
.inputLogin{
width:20px;height:20px;background:url(img/msg_bg.png) no-repeat;background-position:0px -150px;
}
</style>
定义的css样式,仔细看InputError和其它的区别你会明白很多
看看页面是怎么定义的呢:
<div id="ceshi" class="inputLogin"></div>
<a href="javascript:checkName()" >click</a>
再看看我们的js吧
function checkName(){
var uu = document.getElementById("ceshi");
uu.className="InpuRight";
uu.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color='red'>asdfdsf</font>";
}
看看我们的一开始运行吧
再看看click后的吧
小小的研究啊,用去了我半天的时间,悔恨当初没有好好的学啊!


相关文档:

12个javascript 库外链

首先是十个JS FRAMEWORK
jquery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
jquery UI
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
Chrome Frame
<script src=& ......

CSS公用文件

由于各浏览器的默认CSS样式不一样,我们必须写一个CSS Reset统一起来。
通常我的做法是在common.css里写全局控制,这里面也包括header和footer,其它CSS文件就通过@import url(”common.css”);引用。
body{padding:10px;margin:0;background:#fff;font-size:12px;line-height:14px;color:#333;font-family:Ari ......

JavaScript随机变换表格背景

s<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档< ......

如何用javascript JQuery 判断图片是否存在!!!

个人记录在案,以免遗忘。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
    <s ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号