// JScript 文件
DianCMS_$ = function (em) {
if (document.getElementById) { return document.getElementById(em); }
else if (document.all) { return document.all[em]; }
else if (document.layers) { return document.layers[em]; }
else { return null; }
}
var tid = 0;
function ShowTabs(cid) {
if (cid != tid) {
DianCMS_$("TabTitle" + tid).className = "title5";
DianCMS_$("TabTitle" + cid).className = "title6";
DianCMS_$("Tabs" + tid).style.display = "none";
DianCMS_$("Tabs" + cid).style.display = "";
tid = cid;
}
}
function WinOpen(url, n, w, h) {
var left = (screen.width - w) / 2;
var top = (screen.height - h) / 2;
var f = "width=" + w + ",height=" + h + ",top=" + top + ",left=" + left + ",scrollbars=1";
var c = window.open(url, n, f);
return c;
}
function Win_Open(url, n, w, h) {
var left = (screen.width - w) / 2;
var top = (screen.height - h) / 2;
var f = "width=" + w + ",height=" + h + ",top=" + top + ",left=" + left + "";
var c = window.open(url, n, f);
return c;
}
function WinOpenDialog(url, w, h) {
var feature = "dialogWidth:" + w + "px;dialogHeight:" + h + "px;center:yes;status:no;help:no;scrollbars:no";
alert(feature);
showModalDialog(url, window, feature);
}
function WinOpenLhgDialog(name, url, w, h, css) {
$.dialog({
lock: true,
min: false,
max: false,
title: '' + name + '',
width: w,
height: h,
content: 'url:' + url + ''
});
}
function ListBoxOpen(tite, name, url, w, h, css) {
var v = DianCMS_$(name).value;
WinOpenLhgDialog(tite, '' + url + '&v=' + v + '', w, h, css);
}
var range;
function WinOpenLhgFocusDialog(Control, name, url, w, h, css) {
DianCMS_$('' + Control + '').focus();
if (window.getSelection) {
range = document.getElementById(Control);
}
else {
range = document.selection.createRange();
}
WinOpenLhgDialog(name, url, w, h, css);
}
function SizePlus(name) {
var _height = document.getElementById(name).style.height.replace("px", "");
var __height = Number(_height) + 50;
document.getElementById(name).style.height = __height + "px";
}
function SizeMinus(name) {
var _height = document.getElementById(name).style.height.replace("px", "");
if (Number(_height) > 50) {
var __height = Number(_height) - 50;
document.getElementById(name).style.height = __height + "px";
}
}
//运行代码
function runEx(cod1) {
cod = document.getElementById(cod1)
var code = cod.value;
if (code != "") {
var newwin = window.open('', '', '');
newwin.opener = null
newwin.document.write("
" + code + "
");
newwin.document.close();
}
}
function CreateRange(name, val) {
document.getElementById(name).focus();
if (window.getSelection) {
var value = document.getElementById(name).value;
var n = document.getElementById(name).selectionStart;
var str = value.substring(0, n);
var end = value.substring(n, value.length);
//主流的浏览器,包括mozilla,chrome,safari
document.getElementById(name).value = str + val + end;
}
else if (document.selection) {
document.selection.createRange().text = val;
}
}
function chooseOne(cb, id) {
var obj = document.getElementById(id);
for (i = 0; i < obj.children.length; i++) {
if (obj.children[i] != cb) obj.children[i].checked = false;
else obj.children[i].checked = cb.checked;
//若要至少勾选一个的话,则把上面那行else拿掉,换用下面那行
//else obj.children[i].checked = true;
}
}
function choose_One(cb, id) {
var obj = document.getElementById(id);
for (i = 0; i < obj.children.length; i++) {
if (obj.children[i] != cb) obj.children[i].checked = false;
else obj.children[i].checked = true;
}
}
String.prototype.getQuery = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = this.substr(this.indexOf("\?") + 1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
function getUrlParam(id, name) {
var str = window.location.href.toLowerCase();
DianCMS_$(id).value = str.getQuery(name.toLowerCase());
}
//Ctrl+s保存
function Save() {
if (event.ctrlKey == true && event.keyCode == 83) {
event.returnvalue = false;
DianCMS_$("DianCMS_Submit").click();
}
}
function InfoIsOK(obj) {
DianCMS_$(obj.id + "_Span").style.display = "none";
}
function ExistsField(tablename, field, name, Alias) {
var value = DianCMS_$(name).value;
var id = DianCMS_$(name + "_Id").value;
if (value.length == 0) {
$.dialog.alert('' + Alias + '不能为空', function () {
DianCMS_$(name).focus();
});
return false;
}
D.BLL.B_Common.ExistsField(tablename, field, value, id, callbackExistsField);
}
function callbackExistsField(data) {
$.dialog.alert('' + data.value + '', function () {
})
}
function RadioShow(name, divName) {
var TypeCount = document.getElementsByName(name);
if (TypeCount[1].checked) {
DianCMS_$(divName).style.display = "none";
}
else {
DianCMS_$(divName).style.display = "";
}
}
function VoteForm(app, n, itemId, styleId) {
var rdo = document.getElementsByName(n);
var v = "";
for (var i = 0; i < rdo.length; i++) {
if (rdo[i].checked) {
v += rdo[i].value + ",";
}
}
$.ajax({ type: 'get', url: '' + app + '/common/submitvote.aspx', data: "ItemId=" + itemId + "&v=" + v + "&styleId=" + styleId + "", dataType: 'html', success: callbackVote });
}
function callbackVote(data) {
var v = data.split("☂");
switch (v[0]) {
case "101":
alert(v[1]);
break;
case "100":
VSLabelPager("" + v[3] + "/common/voteform.aspx?ItemId=" + v[1] + "&StyleId=" + v[2] + "", "DianCMS_VoteForm_" + v[1] + "");
break;
case "102":
alert(v[1]);
window.location.href="" + v[2] + "/user/login.aspx?ReturnUrl=" + escape(window.location) + "";
break;
}
}
///获取RadioButtonList选中值的方法
function commonRadio(name) {
var value = "";
var vRbtid = document.getElementById(name);
//得到所有radio
var vRbtidList = vRbtid.getElementsByTagName("input");
for (var i = 0; i < vRbtidList.length; i++) {
if (vRbtidList[i].checked) {
value = vRbtidList[i].value;
}
}
return value;
}
function showVote(app, itemId, w, h) {
WinOpenLhgDialog('查看投票结果', '' + app + '/common/showvote.aspx?ItemId=' + itemId + '', w, h, '');
}
function gettag(f, tf) {
var tag = DianCMS_$(f).value;
D.BLL.B_Common.GetTag(tag, tf, calbacktotag);
}
function calbacktotag(res) {
var v = res.value.split("☂");
DianCMS_$(v[0]).value = v[1];
}
var nsms = 0;
var tatalsms = 60;
function getsms(name) {
//发送短信
var mobile = DianCMS_$(name).value;
if (mobile.length == 0) {
alert("请输入手机号!");
DianCMS_$(name).focus();
return false;
}
D.BLL.B_SMS.send(mobile);
//
getsms2();
}
function getsms2() {
nsms++;
if (nsms == tatalsms) {
DianCMS_$("btnsms").disabled = false;
DianCMS_$("btnsms").value = " 获取验证码 ";
nsms = 0;
} else {
DianCMS_$("btnsms").disabled = true;
DianCMS_$("btnsms").value = "没有收到?(" + (tatalsms - nsms) + ")秒后重新获取";
window.setTimeout("getsms2()", 1000);
}
}