[JS]Multy language by javascript

2017-11-29 写技术

var get_lan=function(){ $(".lan").each(function(){ var lan_key=$(this).attr("data_lan"); lan_key="g_lan."+lan_key; var lan_key=eval("("+lan_key+")"); $(this).text(lan_val); }) }

阅读全文>>

标签: JS

评论(0) 浏览(136)

[JS]A demo of websockets on javascript

2017-11-6 写技术

ws = new WebSocket("ws:192.168.0.100:4444"); ws.onopen = function(e) { console.log("Connected"); ws.send("Hello nicholas server!"); }; ws.onclose = function(e) { console.log("Disconnected: " + e.reason); }; ws.onerror = function(e) { console.log(...

阅读全文>>

标签: JS

评论(0) 浏览(177)

[JS]漂亮的chart.js实例——js图表

2017-8-1 写技术

<div style="width:600px; height:450px;"> <canvas id="canvas"></canvas> </div> <script type="text/javascript" src="Chart.min.js"></script> <script type="text/javascript"> var ctx = new Chart(document.getElementById("canvas").getContext("2d")); var op...

阅读全文>>

标签: JS

评论(0) 浏览(517)

[JS]分级图片加载

2017-4-4 写技术

在页面中使用分级图片加载的方法一个: <script src="jquery.min.js"></script> <script> var acimg = function(ac_style, ac_high){ if(!ac_style){ ac_style="anycle"; } if(!ac_high){ ac_high="high"; } var _ac_filter = "img."+ac_style; $(_ac_filter).each(function(){ _ac_src = $(th...

阅读全文>>

标签: JS

评论(0) 浏览(248)

[JS]Call functions or values between sub iframe and parent page

2017-3-29 写技术

I always forgotten how to call functions or values between sub iframe and parent page in javascript. Now make a demo to mark it here. Here is parent page: <iframe src="sub.html" style="width:100%; height:500px; border:1px solid gray;"></iframe> <input type="button" v...

阅读全文>>

标签: JS

评论(0) 浏览(234)

[JS]Change a searching options of a web page

2017-3-28 写技术

There is a function by myself to change a searching options of a web page. function setName(name, val) { var isSet = 0; var url=window.location.search; var search = ""; if(url.length>200){ return 0; } var url_domain = window.location.href; if(url_domain.indexOf("?")!=-...

阅读全文>>

标签: JS

评论(0) 浏览(236)

[JS]用一段代码去遍历QQ号码

2017-3-1 写技术

用一段代码去遍历QQ号码,然后你就可以方便地在文件里查找自己喜欢的号码了, 不过现在玩QQ号码的人应该很少了——我玩的不是号码: // 地址:http://haoma.qq.com/shop.html var ret = ""; var i=0; function nextqq(){ $(".search_mod_list ul li").each(function(){ var str = $(this).find("a").attr("href"); str = str.split('num='); str = str[1...

阅读全文>>

标签: JS

评论(0) 浏览(268)

[JS]How to set a navigation hight light dynamic

2017-1-25 写技术

How to set a navigation hight light dynamic? There is a javascript solution: var url = window.location.pathname + window.location.search; url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, ""); $(".sNav").find("a[href='" + url...

阅读全文>>

标签: JS

评论(0) 浏览(227)

[JS]How to decode xml string

2017-1-22 写技术

There's some part of my project. You must include the jquery first. var xmlDoc = $.parseXML( this.result ); var idx = 0; $(xmlDoc).find('Worksheet Table Row').each(function(){ }

阅读全文>>

标签: JS

评论(0) 浏览(231)

[JS]How to read local file in JS

2017-1-22 写技术

How to read local file in JS? function jsReadFiles(files) { if (files.length) { var file = files[0]; var reader = new FileReader(); if (/text+/.test(file.type)){ reader.onload = function(){ $('body').append('<pre>' + this.result + '</pre>'); } ...

阅读全文>>

标签: JS

评论(0) 浏览(259)

Powered by anycle 湘ICP备15001973号