js jq分割字符串并延时加载到页面元素
2016-01-05 20:24
706 查看
直接解析
延时加载
二维字符串解析
<!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" xml:lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Lifushan`s</title> <meta name="keywords" content="关键字列表" /> <meta name="description" content="网页描述" /> <link rel="stylesheet" type="text/css" href="" /> <link rel = "shortcut icon" href = "indexstatic/icon.ico" /> <style type="text/css"> .zone{font-size:14px;float:left;max-width:200px;border:1px solid gray;margin:35px;padding:10px} .pic{width:180px;} .admin{color:black} </style> <script src="http://libs.baidu.com/jquery/1.7.2/jquery.js"></script> <script type="text/javascript"> $().ready(function(){ //do something var h=$("#hided").text(); var arr=h.split('|'); $("#title").text(arr[0]); $("#author").text(arr[1]); $("#content").text(arr[2]); //alert(h); }) </script> </head> <body> 标题:<span id="title"> </span></br> 作者:<span id="author"> </span></br> 内容:<span id="content"> </span></br> <div id="hided" style="display:none">你好|黎富山|今天很高兴!</div> </body> </html>
延时加载
<!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" xml:lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Lifushan`s</title> <meta name="keywords" content="关键字列表" /> <meta name="description" content="网页描述" /> <link rel="stylesheet" type="text/css" href="" /> <link rel = "shortcut icon" href = "indexstatic/icon.ico" /> <style type="text/css"> .zone{font-size:14px;float:left;max-width:200px;border:1px solid gray;margin:35px;padding:10px} .pic{width:180px;} .admin{color:black} </style> <script src="http://libs.baidu.com/jquery/1.7.2/jquery.js"></script> <script type="text/javascript"> $().ready(function(){ //do something //alert(h); function showtime(){ var h=$("#hided").text(); var arr=h.split('|'); $("#title").text(arr[0]); $("#author").text(arr[1]); $("#content").text(arr[2]); } var test = setTimeout(function(){ showtime() },2000); }) </script> </head> <body> 标题:<span id="title"> </span></br> 作者:<span id="author"> </span></br> 内容:<span id="content"> </span></br> <div id="hided" style="display:none">你好|黎富山|今天很高兴!</div> </body> </html>
二维字符串解析
<!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" xml:lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Lifushan`s</title> <meta name="keywords" content="关键字列表" /> <meta name="description" content="网页描述" /> <link rel="stylesheet" type="text/css" href="" /> <link rel = "shortcut icon" href = "indexstatic/icon.ico" /> <style type="text/css"> .zone{font-size:14px;float:left;max-width:200px;border:1px solid gray;margin:35px;padding:10px} .pic{width:180px;} .admin{color:black} </style> <script src="http://libs.baidu.com/jquery/1.7.2/jquery.js"></script> <script type="text/javascript"> $().ready(function(){ //do something //alert(h); function showtime(){ var h=$("#hided").text(); var arr=h.split('@'); var arr1=arr[0].split('|'); $("#title").text(arr1[0]); $("#author").text(arr1[1]); $("#content").text(arr1[2]); var arr2=arr[1].split('|'); $("#title1").text(arr2[0]); $("#author1").text(arr2[1]); $("#content1").text(arr2[2]); } var test = setTimeout(function(){ showtime() },2000); }) </script> </head> <body> 标题:<span id="title"> </span></br> 作者:<span id="author"> </span></br> 内容:<span id="content"> </span></br></br></br> 标题:<span id="title1"> </span></br> 作者:<span id="author1"> </span></br> 内容:<span id="content1"> </span></br> <div id="hided" style="display:none">你好|黎富山|今天很高兴!@你不好|黎科恩|今天很苦恼!</div> </body> </html>
相关文章推荐
- csv.js导出csv
- JavaScript_两个练习
- Extjs中async属性的使用
- 通过jsp的URL进行参数传递的时候出现参数为空的情况
- js中判断一个对象的类型的种种方法
- Common JS Function
- JSONP跨域
- fastjson 版本性能
- JavaScript阻止事件冒泡
- JavaScript阻止事件冒泡
- html5图形库fabric.js实现二叉树
- JavaScript_节点相关操作
- jsp 校验数字 保留两位小数 不能输入汉字
- javascript可以访问到到cookie么
- JSON 对象处理
- js中JSON的使用
- gson json字符串转换
- js在html中执行顺序
- 运行setup.js文件
- html5添加canvas来将图片制作成马赛克效果的js插件教程