常见问题分类
搜索关键词为(js)的结果
-
386
/
/
js 获取url的多种方式
window.location.href:这个属性返回当前窗口(当前页面、iframe)的完整 URL。 window.parent.location.href 是上一层页面跳转url window.top.location.href 是最外层的页面跳转url document.URL:这个属性也可以用来获取当前窗口的完整 URL window.location.toString():使用该方法同样可以获得当前页面的完整 URL。 window.location.protocol + '//' + window.location.host + window.location.pathname -
415
/
/
JS调试输出
使用 window.alert() 弹出警告框。 使用 document.write() 方法将内容写到 HTML 文档中。 使用 innerHTML 写入到 HTML 元素。 使用 console.log() 写入到浏览器的控制台。 -
388
/
/
php json输出中文乱码
{"code":201,"msg":"\u6765\u6e90\u9519\u8bef!"}原因:json输出时会对中文进行编码,需要指定为不进行编码,如下:
echo json_encode($data, JSON_UNESCAPED_UNICODE);//不进行Unicode编码 -
352
/
/
JS修改数组对象中的属性值
var content = [{"type":"add","state":false},{"type":"update","state":false},] for(var i=0;i if(content[i].type == "add"){ content[i].state=true; } } -
305
/
/
JS时间戳转时间日期函数
resolvingDate(date){ if(!date){ return; } //date是传入的时间 var d = new Date(parseInt(date + '000')); let month = (d.getMonth() + 1) < 10 ? '0'+(d.getMonth() + 1) : (d.getMonth() + 1); let day = d.getDate()<10 ? '0'+d.getDate() : d.getDate(); let hours = d.getHours()<10 ? '0'+d.getHours() : d.getHours(); let min = d.getMinutes()<10 ? '0' -
364
/
/
PHP将json转为数组
json_decode($json,true); PHP将数组转为json json_encode($data,JSON_UNESCAPED_UNICODE ); -
386
/
/
JS链接跳转
window.location.href="" -
369
/
/
讯睿CMS JS 提示函数
dr_tips(code,msg,time); -
376
/
/
JS确定取消对话框
if(window.confirm('你确定要执行删除操作吗?')){ alert("您点击了确定"); }else{ alert("您点击了取消"); return false; }
如您有其它疑问,还可以通过右侧方式咨询:
E-mail:
821266862@qq.com