常用方法
//截取(单)参数方法
function getUrlParamsData(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
//获取当前时间
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
}
//生成随机数32位
function newGuid() {
var guid = "";
for (var i = 1; i <= 32; i++) {
var n = Math.floor(Math.random() * 16.0).toString(16);
guid += n;
if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
guid += "-";
}
return guid;
}
//动态获取ifream高度
//改变父级iframe高度
var parentIframe = parent.$('.treeseven');
setTimeout(function(){
parentIframe.css("height",document.body.scrollHeight);
parent.count();}
,100);
//页签切换
var m_tabSwitch = function() {
var m_tabs = $('.tab-switch li');
m_tabs.click(function(e) {
// 清除默认事件
e.preventDefault();
var index = $(this).index();
//避免因为两个页签产生干扰
var m_detail = $(this).parents('.tab:first').find('.switch-detial:first > div');
//避免因为两个页签产生干扰
$(this).parents('.tab-switch:first').find('li').removeClass('active');
$(this).addClass('active');
m_detail.removeClass('active');
m_detail.eq(index).addClass('active');
})
}