$.type()的用法
来源:互联网 发布:自学编程网站有哪些 编辑:程序博客网 时间:2024/06/05 16:46
jquery中$是对jQuery类的简写,$.type等价于jQuery.type
js代码
function Test1(cfg){var list = new Array();if($.type(cfg)=='array'){console.log('我是数组');list = list.concat(cfg);}else if(jQuery.type(cfg)=='object'){console.log('我是对象');list.push(cfg);}else if($.type(cfg)=='boolean'){console.log('我是布尔值');list.push(cfg);}else if(jQuery.type(cfg)=='number'){console.log('我是数字值');list.push(cfg);}else if($.type(cfg)=='string'){console.log('我是字符串');list.push(cfg);}else if(jQuery.type(cfg)=='function'){console.log('我是函数');list.push(cfg);}else if($.type(cfg)=='error'){console.log('我是错误');list.push(cfg);}else if(jQuery.type(cfg)=='date'){console.log('我是日期');list.push(cfg);}else if($.type(cfg)=='regexp'){console.log('我是正则表达式');list.push(cfg);}}html代码
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title><meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> <script type="text/javascript" src="jquery-1.7.js"></script> <script type="text/javascript" src="jquery-1.7.min.js"></script> <script type="text/javascript" src="my.js"></script> <script type="text/javascript"> $(function(){Test1([{id : '1',name : '张三',params : {age : '20',tell : '1234567'}}]);Test1({id : '1',name : '张三',params : {age : '20',tell : '1234567'}});Test1(true);Test1(12);Test1("name");Test1(function(){});Test1(new Error());Test1(new Date());Test1(/test/);var br = $("<br/>");$(".myspan").append(br); }) </script> </head> <body> </body></html>输出
0 0
- config-type的用法
- TYPE POOLS 的用法...
- type的用法
- type的用法总结
- type命令的用法
- $.type()的用法
- type of的用法
- *(type **)用法
- C++ Type traits的简单用法
- System.Type.GetType函数的用法
- Oracle 自定义TYPE 的几种用法
- oracle中%type和%rowtype的用法
- Struts2 result type="stream"的用法
- error:记错了type的用法
- Oracle 自定义TYPE 的几种用法
- input type="radio" 的用法
- Struts中type="chain"的用法!
- 简述%TYPE和%ROWTYPE的用法
- 多个串公共子串算法
- loopback学习(5)--扩展API
- Host is not allowed to connect to this MySQL server错误的解决办法
- Linux系统的在线求助 man page 与 info page
- MySQL数据类型 BLOB和TEXT
- $.type()的用法
- hdu 1166 敌兵布阵 线段树
- day15 python css
- mongodb副本集和分片部署
- 图之 宽度优先遍历 DFS 邻接矩阵建立的图
- 23 服务IntentService Demo6
- ThinkPHP多语言包配置
- 简单ubuntu flask uwsgi 部署教程
- 内核态与用户态详解!!!!!