general.js
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:2k
- function getElement(name) {
- if (document.getElementById) {
- return document.getElementById(name);
- } else if (document.all) {
- return document.all[name];
- } else if (document.layers){
- return document[name];
- } else {
- return 0;
- }
- }
- function jprompt(message,url) {
- input_box=confirm(message);
- if (input_box==true) {
- window.location=url;
- }
- }
- function jprompt_multi(message, message2, urltrue, urlfalse) {
- input_box=confirm(message);
- if (input_box == true) {
- second_box=confirm(message2);
- if (second_box == true) {
- window.location = urltrue;
- } else {
- window.location = urlfalse;
- }
- }
- }
- function checkall(formname) {
- for (var i = 0; i < formname.elements.length; i++) {
- var element = formname.elements[i];
- if ((element.name != "allbox") && (element.type == "checkbox"))
- {
- element.checked = formname.allbox.checked;
- }
- }
- }
- function oc(id) {
- var e=document.getElementById(id).style;
- if (e.display=='') {
- e.display='none';
- } else {
- e.display='';
- }
- }
- function visno(id) {
- e=document.getElementById(id).style;
- e.display='none';
- }
- function visyes(id) {
- e=document.getElementById(id).style;
- e.display='';
- }
- function wysiwyg(form, element, element2) {
- openWindow('./../home/editor.php?form='+form+'&element='+element+'&element2='+element2, 660, 460);
- }
- function openWindow(url,w,h,windowname){
- if (!w) {
- w = '600';
- }
- if (!h) {
- h = '400';
- }
- if (!windowname) {
- windowname = 'window';
- }
- popupWin=window.open(url,windowname,'scrollbars,resizeable,status,'+'width='+w+',height='+h);
- }
- function submitform(formname,valuename,thevalue) {
- var str = "<input type='hidden' name='" + valuename + "' value='" + thevalue + "'>"
- document.getElementById("hiddenbit").innerHTML = str;
- document.forms[formname].submit();
- }
- function datePop(formname,fieldname) {
- var w = '205';
- var h = '185';
- var windowname = 'dateselect';
- year = eval('document.' + formname + '.y' + fieldname + '.options[document.' + formname + '.y' + fieldname + '.' + 'selectedIndex].value;');
- month = eval('document.' + formname + '.m' + fieldname + '.options[document.' + formname + '.m' + fieldname + '.' + 'selectedIndex].value;');
-
- openWindow('./datepop.php?formname='+formname+'&fieldname='+fieldname+'&year='+year+'&month='+month, w, h, windowname);
- }