常用的类型:

1.数学:

Math.ceil():天花板数

Math.floor():地板数

Math.round():四舍五入取整数

Math.random():生成0-1之间的随机数

 

2.日期时间:

var s = new Date();

var s = new Date(1999,7,23);

函数:

getFullYear():

getMonth():

getDate():获取日

getHours()

getMinutes()

getSeconds()

getDay():获取星期

setFullYear(year,month,day)

setHours(hour,minute,second,ms)

toLocaleDateString():转化为本地的日期时间格式字符串

 

3.字符串

length:字符串的长度

toLowerCase()

toUpperCase()

 

//压缩字符串中的两端空格。

function   Trim(m){  

  while((m.length>0)&&(m.charAt(0)==' '))  

  m   =   m.substring(1, m.length);  

  while((m.length>0)&&(m.charAt(m.length-1)==' '))  

  m = m.substring(0, m.length-1);  

  return m;  

}

 

indexOf("子串"):第一次出现的位置

lastIndexOf("子串"):最后一次出现的位置

以上两个方法,如果父串中不包含子串,则返回-1

 

substr("起始位置","截取长度")

substring("起始位置","结束位置")

 

 

 

 

<title>无标题文档</title>

<style type="text/css">

.cc{

width:120px;

height:120px;

background-color:rgb(102,255,102);

}

.dd{width:120px;

height:120px;

border:1px solid blue;

float:left;

margin:10px;}

</style>

<script language="javascript">

function hidediv(dd)

{

dd.style.display="none"

var s=dd.parentNode.getAttribute("haha");

if(s=="1")

{

alert("恭喜你中大奖");

window.location.reload();

}

}

</script>

 

</head>

 

<body>

<div class="dd"><div class="cc"  onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc"  onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

<div class="dd"><div class="cc" onclick="hidediv(this)"></div></div>

</body>

</html>

<script language="javascript">

var divs=document.getElementsByTagName("div")

 

for (var i=0;i<divs.length;i++)

{

if (divs[i].className=="dd")

{

var n=(Math.round(Math.random()*100000000)%10)+1;

var path="images/"+n+".png";

divs[i].style.backgroundImage="url("+path+")"

if(n == 1)

{

divs[i].setAttribute("haha","1");

}

}

}

 

</script>

 

 

<title>无标题文档</title>

<script language="javascript">

function doup(dd){

dd.style.borderColor="gray";

dd.style.backgroundColor="#009900";

dd.style.margin="0px 0px 0px 0px";}

function dodown(dd){

dd.style.borderColor = "blue";

dd.style.backgroundColor="green";

dd.style.margin="1px 0px 0px 1px"

}

</script>

</head>

 

<body>

<span style="display:inline-block;padding:5px; background-color:green; border:3px solid gray; cursor:default " onmousedown="dodown(this)" onmouseup="doup(this)" >点开</span>

</body>

</html>

 

 

 

<title>无标题文档</title>

<script language="javascript">

var bg="white"

function doover(tt)

{

bg = tt.style.backgroundColor;

  tt.style.backgroundColor="yellow"

 

}

function doout(tt)

{

tt.style.backgroundColor=bg}

</script>

</head>

 

<body>

<table width="100%" border="1" cellpadding="0" cellspacing="0">

<tr style=" background-color:#ffccff" onmouseover="doover(this)" onmouseout="doout(this)">

<td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

</tr>

<tr style=" background-color:rgb(51,255,153)" onmouseover="doover(this)" onmouseout="doout(this)">

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

  <tr style=" background-color:navy" onmouseover="doover(this)" onmouseout="doout(this)">

<td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

</tr>

<tr style=" background-color:rgb(204,255,153)" onmouseover="doover(this)" onmouseout="doout(this)">

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

   <tr style=" background-color:blue" onmouseover="doover(this)" onmouseout="doout(this)">

<td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

    <td> </td>

</tr>

</table>

</body>

</html>

 

 

HTML7常用的类型刮刮乐 光棒效果的更多相关文章

  1. asp.net操作GridView添删改查的两种方法 及 光棒效果

    这部份小内容很想写下来了,因为是基础中的基础,但是近来用的比较少,又温习了一篇,发现有点陌生了,所以,还是写一下吧. 方法一:使用Gridview本身自带的事件处理,代码如下(注意:每次操作完都得重新 ...

  2. webform 光棒效果,删除操作弹出确定取消窗口

    鼠标移入onmouseover和鼠标移出onmouseout,代码里没大写我这也就不大写了.那首先,我们得获取Class为tr_item里的所有东西,也就是项标签里的数据.然后呢,我们定义一个oldC ...

  3. jquery添加光棒效果的各种方式以及简单动画复杂动画

    过滤器.绑定事件.动画   一.基本过滤器 语法 描述 返回值 :first 选取第一个元素 单个元素 :last 选取最后一个元素 单个元素 :not(selector) 选取去除所有与给定选择器匹 ...

  4. HTML——JAVASCRIPT——光棒效果

    光棒效果:建立一个表格,鼠标放到哪一行,哪一行的颜色就改变,鼠标离开那一行,那一行的颜色就恢复到原来的颜色 <!DOCTYPE html PUBLIC "-//W3C//DTD XHT ...

  5. 使用javaScript和JQuery制作经典面试题:光棒效果

    使用javaScript与jQuery添加CSS样式的区别和步骤 使用javaScript制作光棒效果 --首先是javaScript <script> $(function () { v ...

  6. Jquery实现光棒效果

    <script type="text/javascript"> $(function () { var $bac; $("#d1 tr").hove ...

  7. jQuery中.bind() .live() .delegate() .on()的区别 和 三种方式写光棒事件 动画

    地狱的镰刀 bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数. $("a").bind("click",function(){ ...

  8. JavaScript--------------------jQuery中.bind() .live() .delegate() .on()的区别 和 三种方式写光棒事件 动画

    bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数. $("a").bind("click",function(){alert( ...

  9. 用js写出光棒效应的两种方法与jquery的两中方法

    <script src="js/jQuery1.11.1.js" type="text/javascript"></script> &l ...

随机推荐

  1. Windows下配置sphinx+reStructuredText详解

    最近有朋友想在windows下做个人笔记,没有找到顺手的工具,问我有什么好的工具推荐.正好前两天在网上看到一款做文档的利器sphinx+reStructText,当时在ubuntu下搭了下环境试了试, ...

  2. jquery中push()的用法(数组添加元素)

    push定义和用法 push() 方法可向数组的末尾添加一个或多个元素,并返回新的长度. 语法 arrayObject.push(newelement1,newelement2,....,newele ...

  3. [原创] Assistant editor 取消拖拽 binding 的 UI 元素

    1. press up-right button "show the utilities" 2. press "show the Connections inspecto ...

  4. IOS开发系列 --- 核心动画

    原始地址:http://www.cnblogs.com/kenshincui/p/3972100.html 概览 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥i ...

  5. jquery mobile 入门

    简介:jQuery Mobile框架可以轻松的帮助我们实现非常好看的.可跨设备的Web应用程序.我们将后续的介绍中向大家介绍大量的代码及实例. jQuery一直以来都是非常流行的富客户端及Web应用程 ...

  6. java 简单的文件上传

    一.文件上传原理: 1.文件上传的前提: a.form表单的method必须是post b.form表单的enctype必须是multipart/form-data(决定了POST请求方式,请求正文的 ...

  7. 【Android】设备标识简介(imei imsi mac地址)

    IMEI: 1- 意义: 参考http://zh.wikipedia.org/zh-cn/IMEI  国际移动设备辨识码 ,共15位,和厂商,产地等有关. 2- 获取: 直接查看设备信息,设置-关于手 ...

  8. AprioriTID algorithm

    What is AprioriTID? AprioriTID is an algorithm for discovering frequent itemsets (groups of items ap ...

  9. Outlook2007、2010和Foxmail的簽名設計

    由於個人習慣問題公司大部分人採用第三方郵件工具,對與郵件的通訊設置大家完全可以通過嚮導完成,但是郵件的簽名設計往往隐藏了起来,现在就由我来带大家进行个性签名设计. Outlook2007 第一步: 点 ...

  10. 浅谈 qmake 之 shadow build(就是将源码路径和构建路径分开)

    shadow build shadow build 是什么东西?就是将源码路径和构建路径分开(也就是生成的makefile文件和其他产物都不放到源码路径),以此来保证源码路径的清洁. 这不是qmake ...