随笔分类 - javascript
摘要:f1.html代码 ww.html代码 使用 console.log($('#frame1')) 查看参数 获取值的方法
阅读全文
摘要:方法一: js代码:增加一行五列的表格 方法二:
阅读全文
摘要:1.最简介写法 2.进阶写法 3.json返回数据 php 输出代码 js代码 4.【高级json】php,ajax,json 返回的json是多维数组 php输出的代码 js代码 json个数: (html.length)
阅读全文
摘要:js代码function confirm_redirect(msg, url){ if (confirm(msg)) { location.href=url; }}html删除
阅读全文
摘要:function timer() { var ts = (new Date(2018, 11, 11, 9, 0, 0)) - (new Date());//计算剩余的毫秒数 var dd = parseInt(ts / 1000 / 60 / 60 / 24, 10);//计...
阅读全文
摘要:1.网页右侧地图浮动楼层,超过100px就显示$(window).scroll(function(){ if($(window).scrollTop()<100){ //距顶部多少像素时,出现返回顶部按钮 $("#floor").fadeOut(); ...
阅读全文
摘要:.floor-box{width: 44px; border: 1px solid #ccc; position: fixed; left: 50%; z-index: 1000}漂浮距离,距中间50%.floor-box{width: 44px; border: 1px solid #ccc; p...
阅读全文
摘要:1.function scrollTop(){ ("#side-bar .gotop").click(function(){ $('html,body').animate({'sc...
阅读全文
摘要:1.点击显示,再次点击隐藏$("#pingfen-click").click(function(){ name = document.getElementById("pf-window").className; if(...
阅读全文
摘要:1、HTML结构我的类名为test_class2、javascript代码function fun(){ name = document.getElementById("test").className; alert(name);}成品案例$("#pingfen-click").clic...
阅读全文
摘要:function getInput(val,a){ var id = 'ser-key'; if(a=='focus'){ document.getElementById(id).value=''; } if(a=='blur'){ ...
阅读全文
摘要:前端开发框架Bootstrap 网址:http://www.dnzs.com.cn/w3cschool/bootstrap/bootstrap-tutorial.html需要加入代码一起三段代码css代码.wrap{/*width: 980px;*/ margin: 0 auto;}@media(m...
阅读全文
摘要:var thisId = window.location.hash;alert(thisId);输出#2
阅读全文
摘要:// 收缩菜单 $("#leftMenu li h3").click(function(){ (this).next('.ajax').css('display'); if($v =='none'){ $(this)...
阅读全文
摘要:跨域的简单原理:一般浏览器会阻止js请求异端服务器(A服务器请求B服务器)。js连接却除外 如: 还有iframe、css、script 都可以进行异端请求数据。本地html无标题文档需要放服务器上的js文件function ajax(){ $.ajax({ url:'t.htm...
阅读全文
摘要:JSONP原理JSONP(JSON with Padding),就是异步请求跨域的服务器端时,不是直接返回数据,而是返回一个js方法,把数据作为参数传过来。如果只是跨域传递数据那么这种方式是比较好的。字面理解就是:利用内填充的原理,将json填充到一个box中的概念。原理总是又饶又拗口,直接来个简单...
阅读全文
摘要:1.json_encod基本用法:数组转字符串 2.json_decode基本用法:字符串转数组 3.json_encode在输出汉字的时候会被转义 输出结果:(汉字都会被转义) {"t1":"\u6d4b\u8bd5\u4e0b\u4e2d\u6587\u6c49\u5b57","t2":"www
阅读全文