ylbtech-jQuery:函数-导航
jQuery:3.1,添加样式(addClass)、移除样式(removeClass) 返回顶部
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.selected{ background-color:red}
</style>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("p").toggle(function(){
$(this).addClass("selected");
},function(){
$(this).removeClass("selected");
});
});
</script>
</head> <body>
<p>ylbtech</p>
<p>ylbtech</p>
<p>ylbtech</p>
<p>ylbtech</p> </body>
</html>
jQuery:3.2,轮替函数(toggle()) 返回顶部
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
.select{background-color:red;
}
</style>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn1").click(function(){
$(this).addClass("select");
});
$("#btn2").click(function(){
$(this).removeClass("select");
});
$("#btn3").click(function(){
$(this).toggleClass("select");
});
});
</script>
</head> <body>
<input id="btn1" type="button" value="ajax1" />
<input id="btn2" type="button" value="ajax2" class="select" />
<input id="btn3" type="button" value="ajax1" />
</body>
</html>
jQuery:3.3,选项拼加 返回顶部
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function list(check_b,txt)
{
var str_S=txt.value;
var str_C=check_b.value;
if(check_b.checked==true)
{
txt.value=str_S+str_C;
}
else
{
str_S=str_S.replace(str_C,"");
txt.value=str_S;
}
}
</script>
</head> <body>
我们选择了:<input type="text" name="t_1" value="" readonly="true" />
<br />
<input type="checkbox" value="苹果 " onclick="list(this,t_1)" >苹果</input>
<input type="checkbox" value="香蕉 " onclick="list(this,t_1)" >香蕉</input>
<input type="checkbox" value="芹菜 " onclick="list(this,t_1)" >芹菜</input>
</body>
</html>
jQuery:3.4全选 返回顶部
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function ca()
{
for(i=0;i<f.news.length;i++)
{
f.news[i].checked=f.all.checked;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title>
</head> <body><br />
<form name="f" style="font-size:36px">
全选<input type="checkbox" name="all" onclick="ca()"/><br />
军事<input type="checkbox" name="news"/><br />
政治<input type="checkbox" name="news"/><br />
娱乐<input type="checkbox" name="news"/><br />
体育<input type="checkbox" name="news"/><br />
</form>
</body>
</html>
jQuery:3.5网页刷点器 返回顶部
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>袁博刷点 高效一流</title>
<script language="javascript">
var count=3;
var sumcount=100;//默认100次
var intervalid;
var url;
function funfirst()
{
intervalid=setInterval("fun1()",1000)
var txtsum=document.getElementById("txtcount").value;
if(txtsum.length!=0)
{
sumcount=parseInt(txtsum);
}
}
function fun1()
{
sumcount--;
var onclickurl=document.getElementById("txturl").value;
url=window.open("http://"+onclickurl,"_blank","");
if(sumcount<=1)
{
fun3();
}
fun2();
}
function fun2()
{
count--;
if(count<0)
{
url.close();
}
}
function fun3()
{
clearInterval(intervalid);
}
</script> </head> <body> 请在下输入你想要刷的网址(注:本产品仅支持在IE浏览器使用)
<table width="326" border="1">
<tr>
<td width="168"><input type="text" id="txturl" /></td>
<td width="68"><input type="button" value="开始刷点" onclick="funfirst()"></td>
<td width="68"><input type="button" value="停止刷点" onclick="fun3()" /></td>
</tr>
<tr>
<td height="33">格式如:www.baidu.com</td>
<td>刷点次数</td>
<td><input type="text" id="txtcount" width="20px" />
默认为100次</td>
</tr>
</table> </body>
</html>
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

JS:实用功能的更多相关文章

  1. js实用功能

    //日期格式转换 Date.prototype.format = function (format) {     /*      * eg:format="yyyy-MM-dd hh:mm: ...

  2. 移动端报表JS开发示例

    最近对移动端的报表开发颇有研究,细磨精算了好久,虽然到现在还是“囊中羞涩”,但决定还是先抛砖引玉,拿点小干货出来和大家分享. 研究的工具是比较有代表性的FineReport. 1.  移动端哪些地方支 ...

  3. Underscore.js使用

    Underscore 是一个 JavaScript 工具库,它提供了一整套函数式编程的实用功能,但是没有扩展任何 JavaScript 内置对象. 他解决了这个问题:"如果我面对一个空白的 ...

  4. 钉钉js依赖库学习

    看别人用的依赖库的好处在于,你知道有什么可以用,什么可以借鉴.(钉钉——协作桌面应用) PS:人最怕是不知道,而不是你不会. 1. jQuery 钉钉使用了1.9.1版本的jQuery,jQuery作 ...

  5. 百度地图 api 功能封装类 (ZMap.js) 本地搜索,范围查找实例 [源码下载]

    相关说明 1. 界面查看: 吐槽贴:百度地图 api 封装 的实用功能 [源码下载] 2. 功能说明: 百度地图整合功能分享修正版[ZMap.js] 实例源码! ZMap.js 本类方法功能大多使用 ...

  6. sublime Text 3实用功能和常用快捷键收集

    下面是我通过网上视频教程或文本资料学习sublime Text3时收集的一些实用功能和常用快捷键,现在分享出来,如果还有其它的好用的功能可以在下面留言,以便互相学习. PS:ST3在Mac OX与Wi ...

  7. template模版与Underscore.js

    template模版与Underscore.js 在项目中经常使用的模版是Underscore这个js框架的实用功能. 在html里面设定模板,然后js绑定数据,这样能避免在js中出现非常多的html ...

  8. js 模板引擎 - 超级强大

    本来没想写这篇文章,但是网上误导大众的文章太多了,所以今天就抽出半小时时间谈一下我对前端模板引擎的感受吧. 前端模板引擎相信大家都再熟悉不过了,市面上非常多的号称最好.最快.最牛逼的,随便就能找到一大 ...

  9. Node.js工具模块

    在Node.js的模块库中提供实用的模块数量. 这些模块都是很常见的,并同时开发基于任何节点的应用程序频繁使用. S.N. 模块的名称和说明 1 OS Module提供基本的操作系统相关的实用功能 2 ...

随机推荐

  1. POJ 1804

    /* *由此题发现规律 就是冒泡排序的交换次数等于这个数列的逆序对 的对数! */ #include<iostream> #include<stdio.h> #include& ...

  2. php集成开发环境的安装以及Zend Studio开发工具的安装

    一.集成开发环境: wampserver 下载地址: 官网: http://www.wampserver.com/ 直接下载 http://sourceforge.net/projects/wamps ...

  3. Git PHP提交

    做了个小的DEMO,可以查看: https://github.com/feixiang/webgit.git 这几天一直在郁闷的事情. Git在shell里面执行得好好的,apache运行用户也改成了 ...

  4. Play Framework 2.2.6 安装

    网络上很多安装方法都是互相复制黏贴的, 都没有人考虑到启动application 还有依赖很多jar 包,而其中typesafe 官网提供的只是一个mini的 启动器来安装,很慢,所以以下下载完整包. ...

  5. 使用Css截取字符串

    white-space:nowrap; /* 禁止自动换行 */ overflow:hidden; /* 隐藏溢出的内容 */ text-overflow:ellipsis; /* 溢出文本使用... ...

  6. I²C接口学习总结

    1.IIC总线概念:   a.只有两条总线线路:一条串行数据线,一条串行时钟线.   b.每个连接到总线的器件都可以使用软件根据它们的唯一的地址来识别.   c.传输数据的设备间是简单的主从关系.   ...

  7. Hibernate逍遥游记-第15章处理并发问题-003乐观锁

    1. 2. drop database if exists SAMPLEDB; create database SAMPLEDB; use SAMPLEDB; drop table if exists ...

  8. 转:Servlet的url匹配以及url-pattern详解

    Servlet是J2EE开发中常用的技术,使用方便,配置简单,老少皆宜.估计大多数朋友都是直接配置用,也没有关心过具体的细节,今天遇到一个问题,上网查了servlet的规范才发现,servlet中的u ...

  9. php程序员应具有的7种能力

    php程序员应具有什么样的能力,才能更好的完成工作,才会有更好的发展方向呢?在中国我想您不会写一辈子代码的,那样不可能,过了黄金期,您又怎么办呢?看了本文后,希望对您有所帮助. 一,php能力 1,了 ...

  10. VS2012 开发SharePoint 2013 声明式workflow action(activity)之 HelloWorld

    本文讲述VS2012 开发SharePoint 2013 声明式workflow action 之 HelloWorld. 使用VS2012开发客户化的workflow action是SharePoi ...