写了几个类,希望对大家有用。

1.日历

#oContainer {
width: 193px;
padding: 3px;
background-color: menu;
border-left: buttonhighlight 1px solid;
border-top: buttonhighlight 1px solid;
border-right: buttonshadow 1px solid;
border-bottom: buttonshadow 2px solid;
}
.DateTable {
font: 10pt;
word-break: break-all;
}
.WeekTd, .BlankTd {
font: 10pt;
border: 1px solid menu;
}
.Today {
font: 10pt;
color: red;
cursor: hand;
position: relative;
left: 1px;
top: 1px;
border-left: 1px solid dimgray;
border-top: 1px solid dimgray;
border-right: 1px solid white;
border-bottom: 1px solid white;
}
.MonthTd {
font: 10pt;
font-family: webdings;
cursor: hand;
border: 1px solid menu;
zmm: expression(onmouseenter = function() {
style.color = 'red';
},
onmouseout = function() {
style.color = '';
});
}
.SelectTd {
border: 1px solid menu;
}
.over {
position: relative;
cursor: hand;
border-right: 1px solid buttonshadow;
border-bottom: 1px solid buttonshadow;
border-left: 1px solid buttonhighlight;
border-top: 1px solid buttonhighlight;
}
.out {
border-left: 1px solid buttonface;
border-top: 1px solid buttonface;
border-right: 1px solid buttonface;
border-bottom: 1px solid buttonface;
}
.down {
position: relative;
left: 1px;
top: 1px;
border-left: 1px solid dimgray;
border-top: 1px solid dimgray;
border-right: 1px solid white;
border-bottom: 1px solid white;
}

var oDate = new Object();

function DateClass(_container) {
this.author = '51JS.COM-ZMM';
this.version = 'Web Calendar 1.0';
this.container = _container;
this.weekArr = ['日', '一', '二', '三', '四', '五', '六'];
this.dateArr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

this.showTable = function(_year, _month) {
this.container.innerHTML = this.getDateTable(_year, _month);
}

this.getDateTable = function(_year, _month) {
if (this.checkArgs(_year, _month)) {
_year = parseInt(this.checkDate(_year, _month).split('-')[0]);
_month = parseInt(this.checkDate(_year, _month).split('-')[1]);
this.Thead = '

\n';
this.Thead += '

';
this.Thead += '

';
this.Thead += '

\n';
this.Thead += '

';
for (var i=0; i' + this.weekArr[i] + '

';
this.Thead += '

\n';
this.Tbody = '

';
this.dateArr[1] = (!this.checkYear(_year)) ? 28 : 29 ;
for (var i=0; i

';
for (var i=1; i\n

';
} else {
if ((i+this.firstPos(_year, _month))%7==1) this.Tbody += '

\n

';
}
if (!this.today(_year, _month, i)) {
this.Tbody += '

';
} else {
this.Tbody += '

';
}
}
for (var i=0; i

';
this.Tbody += '

\n';
this.TFoot = '

3 ';
for (var i=1900; i' + i + '年';
this.Thead += '';
for (var i=1; i' + i + '月';
this.Thead += '
4
' + i + ' ' + i + '

\n';
this.Table = this.Thead + this.Tbody + this.TFoot;
return this.Table;
} else {
return 'Arguments Error!';
}
}

this.firstPos = function(_year, _month) {
return new Date(_year, _month-1, 1).getDay();
}

this.lastPos = function(_year, _month) {
return new Date(_year, _month-1, this.dateArr[_month-1]).getDay();
}

this.checkYear = function(_year) {
return ((_year % 4 == 0) && (_year % 100 != 0)) || (_year % 400 == 0);
}

this.today = function(_year, _month, _date) {
return (new Date().getFullYear() == _year) && (new Date().getMonth() == _month-1) && (new Date().getDate() == _date);
}

this.checkArgs = function(_year, _month) {
if (_year2100) return false;
if (_month13) return false;
return (!isNaN(_year) && !isNaN(_month));
}

this.checkDate = function(_year, _month) {
if (_month12) {
_year ++;
_month = 1;
}
return _year + '-' + _month;
}

this.showDateStr = function(_year, _month, _date, _week) {
window.alert(_year + '年' + _month + '月' + _date + '日 星期' + _week);
}
}

window.onload = function() {
oDate = new DateClass(self.oContainer);
oDate.showTable(new Date().getFullYear(), new Date().getMonth()+1);
}

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

2.简单的下拉菜单

#oData {
display: none;
}
#oPanel {
width: 120px;
font-size: 12px;
border: 1px solid menu;
padding: 2px;
position: absolute;
display: none;
}
span {
font-size: 12px;
cursor: hand;
}

var oMenu = new Object();

function Menu(_data, _panel) {
this.author = '51JS.COM-ZMM';
this.version = 'Menu 1.0';
this.data = _data;
this.panel = _panel;

this.drawMenu = function(_number, _offsetX, _offsetY) {
var nodeArr = this.data.childNodes;
var _handle = window.event.srcElement;
for (var i=0; i

  • 命令一
  • 命令二
  • 命令三
  • 命令四
  • 命令五
  • 命令六
  • 命令七
  • 命令八
  • 菜单一  
    菜单二  
    菜单三  
    菜单四

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    3. QQ菜单效果

    #oContainer {
    width: 130px;
    height: 300px;
    border: 1px solid menu;
    }

    var oTime, oTencent = new Object();

    function Tencent(_container) {
    this.author = '51JS.COM-ZMM';
    this.version = 'Tencent 1.0';
    this.container = _container;
    this.box = (function(_object) {
    var _box = document.createElement('DIV');
    _box.id = 'TencentBox';
    _box.style.width = _object.offsetWidth;
    _box.style.height = _object.offsetHeight;
    return _box;
    })(this.container);
    this.container.appendChild(this.box);
    this.toolRecord = new Object();
    this.barCount = 0;

    this.drawTencent = function(_barList, _barHeight, _barDelay, _barAmount) {
    var _bool = true;
    this.barList = [];
    this.toolList = [];
    this.barHeight = _barHeight;
    this.barDelay = _barDelay;
    this.barAmount = _barAmount;
    for (var i in _barList) this.barCount ++;
    this.toolHeight = parseInt(this.box.style.height) - this.barCount * this.barHeight;
    for (var i in _barList) {
    var _bar = document.createElement('BUTTON');
    _bar.style.width = this.box.style.width;
    _bar.style.height = _barHeight;
    _bar.style.textAlign = 'center';
    _bar.value = i.toString();
    _bar.hideFocus = true;
    _bar.attachEvent('onclick', this.doClick);
    this.box.appendChild(_bar);

    var _tool = document.createElement('DIV');
    _tool.align = 'center';
    _tool.style.width = this.container.offsetWidth - 2;
    _tool.style.overflowY = 'auto';
    _tool.style.fontSize = '9pt';
    _tool.style.height = (_bool) ? this.toolHeight : 1 ;
    _tool.style.display = (_bool) ? 'inline' : 'none' ;
    _tool.innerHTML = (function(_array) {
    var _html = new String();
    var _bool = new Boolean(true);
    _bool = _bool & (typeof(_array[1]) == 'object');
    _bool = _bool & (typeof(_array[2]) == 'object');
    _bool = _bool & (typeof(_array[3]) == 'object');
    if (_bool) {
    _bool = _bool & (_array[1].length == _array[2].length);
    _bool = _bool & (_array[1].length == _array[3].length);
    _bool = _bool & (_array[2].length == _array[3].length);
    if (_bool) {
    for (var j=0; j';
    _html += '';
    _html += '
    ' + _array[3][j];
    _html += '';
    _html += '

    ';
    }
    } else {
    window.alert('arguments error!');
    }
    } else {
    _bool = _bool & (typeof(_array[1]) == 'string');
    _bool = _bool & (typeof(_array[2]) == 'string');
    _bool = _bool & (typeof(_array[3]) == 'string');

    if (!_bool) {
    _html += '

    ';
    _html += '';
    _html += '
    ' + _array[3];
    _html += '';
    _html += '

    ';
    } else {
    window.alert('arguments error!');
    }
    }
    return _html;
    })(_barList[i]);
    this.box.appendChild(_tool);

    this.barList[this.barList.length] = _bar;
    this.toolList[this.toolList.length] = _tool;
    if (_bool) { this.barCurrent = _bar; this.toolCurrent = _tool; _bool = false; }
    }
    }

    this.doClick = function() {
    var _eventBar = window.event.srcElement;
    with (oTencent) {
    if (!oTime && (barCurrent != _eventBar)) {
    for (var i=0; i 0) ? (parseInt(height) - this.barAmount) : 1 ;
    }
    with (this.toolCurrent.style) {
    height = ((parseInt(height) + this.barAmount)

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    4.对联效果

    var oCouplet = new Object();

    function Couplet(_top, _width, _height, _offset, _delay, _amount) {
    this.author = '51JS.COM-ZMM';
    this.version = 'Couplet 1.0';
    this.top = _top;
    this.width = _width;
    this.height = _height;
    this.offset = _offset;
    this.delay = _delay;
    this.amount = _amount;

    this.drawCouplet = function(_content) {
    this.content = _content;
    var _client = document.body.clientWidth;
    var _css = new String();
    _css += 'top: ' + this.top + 'px;';
    _css += 'width: ' + this.width + 'px;';
    _css += 'height: ' + this.height + 'px;';
    _css += 'position: absolute;';
    _css += 'font-size: 12px;';
    _css += 'border: 1px solid menu;';
    _css += 'overflow: auto;'
    var _html = new String();
    _html += '

    ';
    _html += this.content;
    _html += '

    ';
    _html += '

    ';
    _html += this.content;
    _html += '

    ';
    return _html;
    }

    this.doScroll = function() {
    var _left = document.getElementById('oCouplet_left');
    var _right = document.getElementById('oCouplet_right');
    var _oTop = parseInt(_left.style.top);
    var _nTop = parseInt(document.body.scrollTop) + this.top;
    if (_oTop 0) {
    _left.style.top = _right.style.top = _oTop + 1 + 'px';
    var oTime = window.setTimeout('oCouplet.doScroll()', this.delay);
    } else {
    window.clearTimeout(oTime);
    }
    } else {
    if ((_oTop - _nTop) > 0) {
    _left.style.top = _right.style.top = _oTop - 1 + 'px';
    var oTime = window.setTimeout('oCouplet.doScroll()', this.delay);
    } else {
    window.clearTimeout(oTime);
    }
    }
    }
    }

    window.onload = function() {
    var oTop = 50, oWidth = 120, oHeight = 250, oOffset = 20;
    var oDelay = 80, oAmount = 1;
    oCouplet = new Couplet(oTop, oWidth, oHeight, oOffset, oDelay, oAmount);
    with (document.body) {
    innerHTML += oCouplet.drawCouplet(self.oContent.innerHTML);
    onscroll = function() {
    oCouplet.doScroll();
    }
    }
    }

    对联内容

    
    

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    5.图片轮换

    var oInterval, oTime, oRotator = new Object();

    function Rotator(_container, _width, _height, _array, _delay) {
    this.author = '51JS.COM-ZMM';
    this.version = 'Rotator 1.0';
    this.container = _container;
    this.width = _width;
    this.height = _height;

    this.box = (function(_container, _width, _height) {
    var _box = document.createElement('DIV');
    _box.id = 'RotatorBox';
    _box.align = 'center';
    _box.style.width = _width;
    _box.style.height = _height;
    _box.style.border = '1px solid menu';
    _box.style.overflow = 'hidden';
    return _box;
    })(this.container, this.width, this.height);
    this.container.appendChild(this.box);
    this.sAmount = 0;

    this.drawRotator = function(_array, _delay) {
    this.delay = _delay;
    var _bool = (_array.length == 3);
    _bool = _bool & (_array[0].length == _array[1].length);
    _bool = _bool & (_array[0].length == _array[2].length);
    _bool = _bool & (_array[1].length == _array[2].length);
    if (_bool) {
    this.itemArr = [];
    this.panel = (function(_width, _height, _array) {
    var _panel = document.createElement('DIV');
    _panel.style.position = 'absolute';
    _panel.style.top = '0px';
    _panel.style.left = '0px';
    return _panel;
    })(this.width, this.height, _array);
    for (var i=0; i';
    _html += '

    ';
    _html += '';
    _html += '';
    _html += '

    ';
    _html += '

    ';
    this.itemArr[this.itemArr.length] = _html;
    }
    this.box.appendChild(this.panel);
    this.setPanelContent();
    } else {
    window.alert('arguments error!');
    }
    }

    this.setPanelContent = function() {
    this.panel.innerHTML = this.itemArr.join('');
    }

    this.doScroll = function() {
    with (oRotator) {
    if (sAmount

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    6.listView类

    #oContainer {
    width: 600px;
    height: 500px;
    border: 1px solid menu;
    margin: 0px;
    padding: 0px;
    overflow: hidden;
    }
    a {
    color: black;
    text-decoration: none;
    }
    a:hover {
    color: red;
    text-decoration: underline;
    }

    var oListView = new Object();

    function listView(_container) {
    this.author = '51JS.COM-ZMM';
    this.version = 'ListView 1.0';
    this.container = _container;
    this.box = new Object();
    this.headerWidth = 0;
    this.headerHeight = 20;
    this.itemWidth = 0;
    this.itemHeight = 0;
    this.rowsCount = 30;
    this.isResize = false;
    this.separate = new Object();
    this.startPoint = 0;
    this.endPoint = 0;
    this.tempSeparate = new Object();
    this.put_headerHeight = function(_height) { return _height; };
    this.get_headerHeight = function() { return this.headerHeight; };
    this.put_rowsCount = function(_count) { return _count; };
    this.get_rowsCount = function() { return this.rowsCount; };
    }

    listView.prototype = {
    boxInit : function() {
    this.container.innerHTML = new String();
    this.box = (function(_object) {
    var _box = document.createElement('DIV');
    with (_box) {
    id = 'ListViewBox';
    style.width = _object.offsetWidth;
    style.height = _object.offsetHeight;
    style.margin = '0px';
    style.padding = '0px';
    attachEvent('oncontextmenu', new Function('return false;'));
    }
    return _box;
    })(this.container);
    this.headerPanel = (function(_width, _height) {
    var _headerPanel = document.createElement('DIV');
    with (_headerPanel) {
    style.width = _width;
    style.height = _height;
    }
    return _headerPanel;
    })(this.box.style.width, this.headerHeight);
    this.headerPanel.appendChild(this.textPanel = (function() {
    var _textPanel = document.createElement('NOBR');
    _textPanel.attachEvent('onmousemove', function() {
    with (oListView) {
    if (event.button == 1) {
    textPanel.style.cursor = 'E-resize';
    tempSeparate.style.left = event.clientX - getPosition(box).left;
    tempSeparate.style.display = 'inline';
    endPoint = event.clientX;
    isResize = true;
    }
    }
    });
    return _textPanel;
    })());
    this.rowItemPanel = (function(_width, _height) {
    var _itemPanel = document.createElement('DIV');
    with (_itemPanel) {
    style.width = _width;
    style.height = _height;
    style.overflow = 'hidden';
    }
    return _itemPanel;
    })(this.box.style.width, parseInt(this.box.style.height) - this.headerHeight);
    this.rowItemPanel.appendChild(this.dataPanel = (function() {
    var _dataPanel = document.createElement('NOBR');
    with (_dataPanel) {
    style.cursor = 'default';
    attachEvent('onclick', function() {
    document.selection.empty();
    });
    attachEvent('onselectstart', function() {
    document.selection.empty();
    });
    }
    return _dataPanel;
    })());
    this.dataPanel.appendChild(this.tempSeparate = (function(_height) {
    var _tempSeparate = document.createElement('SPAN');
    with (_tempSeparate) {
    style.width = '1px';
    style.height = _height;
    style.border = '0px';
    style.backgroundColor = 'black';
    style.position = 'absolute';
    style.display = 'none';
    }
    return _tempSeparate;
    })(this.rowItemPanel.style.height));
    this.box.appendChild(this.headerPanel);
    this.box.appendChild(this.rowItemPanel);
    this.container.appendChild(this.box);
    },

    drawListView : function(_headers, _aligns) {
    this.boxInit();
    this.drawHeader(_headers);
    this.drawRowItem(_headers, _aligns);
    document.attachEvent('onmouseup', this.finishResize);
    },

    drawHeader : function(_headers) {
    this.headers = [];
    this.headerWidth = Math.round((parseInt(this.headerPanel.style.width) - (_headers.length - 1) * 1) / _headers.length) + 1;
    for (var i = 0; i  ');
    }
    _tableTr.appendChild(_tableTd);
    _tbody.appendChild(_tableTr);
    }
    _table.appendChild(_tbody);
    return _table;
    })(this.rowsCount, this.itemWidth, Math.round(this.itemHeight / this.rowsCount)));
    }
    this.dataPanel.appendChild(_last);
    this.items[this.items.length] = _last;
    },

    getSeparate : function(_resize) {
    var _separate = document.createElement('SPAN');
    with (_separate) {
    style.width = _resize ? '2px' : '1px' ;
    style.height = this.headerHeight;
    style.border = '1px ' + (_resize ? 'inset white' : 'solid #c6c3c6');
    style.overflow = 'hidden';
    style.position = 'absolute';
    if (_resize) {
    attachEvent('onmousedown', function() {
    with (oListView) {
    separate = event.srcElement;
    startPoint = event.clientX;
    }
    });
    attachEvent('onmouseenter', function() {
    event.srcElement.style.cursor = 'E-resize';
    });
    }
    }
    return _separate;
    },

    getPosition : function(_object) {
    var _top = _left = 0;
    var _root = document.body;
    while (_object != _root) {
    _left += _object.offsetLeft;
    _object = _object.offsetParent;
    }
    return { left: _left };
    },

    resizeItem : function() {
    with (this) {
    var _width, _movePart = endPoint - startPoint;
    for (var i = 0; i this.rowsCount ? this.rowsCount : _datas.length ;
    for (var i = 0; i 编辑  删除'];
    _items[_items.length] = ['标题二', '内容二', '2006-6-21 14:20:12', '编辑  删除'];
    _items[_items.length] = ['标题三', '内容三', '2006-6-21 20:45:36', '编辑  删除'];
    oListView.addListItem(_items);
    }

    attachEvent('onload', initListView);

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    7.表单多文件上传类 [ASP] 


    2 Then
    ReDim Preserve itemStart(itemCount)
    ReDim Preserve itemLength(itemCount)
    itemStart(itemCount) = iStart
    itemLength(itemCount) = iLength
    itemCount = itemCount + 1
    End If
    Loop
    Call FillItemValue
    End Function

    Private Function FillItemValue
    Dim dataPart, bInfor
    Dim iStart : iStart = 1
    Dim iCount : iCount = 0
    Dim iCheck : iCheck = StrToByte("filename")
    For i = 0 To itemCount - 1
    ReDim Preserve itemName(iCount)
    ReDim Preserve itemData(iCount)
    ReDim Preserve extenArr(iCount)
    ReDim Preserve dataStart(iCount)
    ReDim Preserve dataLength(iCount)
    dataPart = MidB(formData, itemStart(i), itemLength(i))
    iStart = InStrB(1, dataPart, ChrB(34)) + 1
    iLength = InStrB(iStart, dataPart, ChrB(34)) - iStart
    itemName(iCount) = FormItemName(MidB(dataPart, iStart, iLength))
    iStart = InStrB(1, dataPart, bVBCrlf) + 4
    iLength = LenB(dataPart) - iStart + 1
    If InStrB(1, dataPart, iCheck) > 0 Then
    bInfor = MidB(dataPart, 1, iStart - 5)
    extenArr(iCount) = FileExtenName(bInfor)
    If Mid(folderPath, Len(folderPath) - 1) = "/" Then
    itemData(iCount) = folderPath & GetRndName(6) & extenArr(iCount)
    Else
    itemData(iCount) = folderPath & "/" & GetRndName(6) & extenArr(iCount)
    End If
    dataStart(iCount) = itemStart(i) + iStart - 2
    dataLength(iCount) = iLength
    Else
    extenArr(iCount) = ""
    itemData(iCount) = ByteToStr(MidB(dataPart, iStart, iLength))
    dataStart(iCount) = ""
    dataLength(iCount) = ""
    End If
    iCount = iCount + 1
    Next
    Call SaveUpload
    End Function

    Private Function FormItemName(byVal bName)
    FormItemName = ByteToStr(bName)
    End Function

    Private Function FileExtenName(byVal bInfor)
    Dim pStart, pLength, pContent, regEx
    pStart = InStr(1, ByteToStr(bInfor), "filename=" & Chr(34)) + 10
    pLength = InStr(pStart, ByteToStr(bInfor), Chr(34)) - pStart
    pContent = Mid(ByteToStr(bInfor), pStart, pLength)
    If pContent = "" Then
    FileExtenName = ""
    Else
    Set regEx = New RegExp
    regEx.Pattern = "^.*(\.[^\.]*)$"
    regEx.Global = False
    regEx.IgnoreCase = True
    FileExtenName = regEx.Replace(pContent, "$1")
    Set regEx = Nothing
    End If
    End Function

    Private Function GetRndName(byVal sLen)
    Dim regEx, sTemp, arrFields, n : n = 0
    Set regEx = New RegExp
    regEx.Pattern = "[^\d]*"
    regEx.Global = True
    regEx.IgnoreCase = True
    sTemp = regEx.Replace(Now, "") & "-"
    Set regEx = Nothing
    arrFields = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", _
    "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", _
    "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", _
    "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", _
    "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", _
    "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", _
    "Y", "Z")
    Randomize
    Do While n "") And (dataLength(i) "") Then
    If dataLength(i) = 0 Then
    itemData(i) = ""
    Else
    filePath = Server.MapPath(itemData(i))
    If CreateFolder("|", ParentFolder(filePath)) Then
    Set oStreamGet = Server.CreateObject("ADODB.Stream")
    oStreamGet.Type = 1
    oStreamGet.Mode = 3
    oStreamGet.Open
    oStreamGet.Write formData
    oStreamGet.Position = dataStart(i)
    Set oStreamPut = Server.CreateObject("ADODB.Stream")
    oStreamPut.Type = 1
    oStreamPut.Mode = 3
    oStreamPut.Open
    oStreamPut.Write oStreamGet.Read(dataLength(i))
    oStreamPut.SaveToFile(filePath)
    oStreamGet.Close
    Set oStreamGet = Nothing
    oStreamPut.Close
    Set oStreamPut = Nothing
    End If
    End If
    End If
    Next
    Finished = True
    Call ItemToColl
    Else
    Finished = False
    End If
    End Function

    Private Function CheckFile
    Dim oBoolean : oBoolean = True
    If cFields = "" Then
    oBoolean = oBoolean And True
    Else
    For i = 0 To itemCount - 1
    If extenArr(i) "" Then
    If InStr(1, Ucase(cFields), "|" & Ucase(Mid(extenArr(i), 2)) & "|") > 0 Then
    oBoolean = oBoolean And True
    Else
    sErrors = sErrors & "表单[ " & itemName(i) & " ]的文件格式错误!\n" & _
    "支持的格式为:" & Replace(Mid(cFields, 2, Len(cFields) - 1), "|", " ") & "\n\n"
    oBoolean = oBoolean And False
    End If
    End If
    Next
    End If
    CheckFile = oBoolean
    End Function

    Private Function CreateFolder(byVal sLine, byVal sPath)
    Dim oFso
    Set oFso = Server.CreateObject("Scripting.FileSystemObject")
    If Not oFso.FolderExists(sPath) Then
    Dim regEx
    Set regEx = New RegExp
    regEx.Pattern = "^(.*)\\([^\\]*)$"
    regEx.Global = False
    regEx.IgnoreCase = True
    sLine = sLine & regEx.Replace(sPath, "$2") & "|"
    sPath = regEx.Replace(sPath, "$1")
    If CreateFolder(sLine, sPath) Then CreateFolder = True
    Set regEx = Nothing
    Else
    If sLine = "|" Then
    CreateFolder = True
    Else
    Dim sTemp : sTemp = Mid(sLine, 2, Len(sLine) - 2)
    If InStrRev(sTemp, "|") = 0 Then
    sLine = "|"
    sPath = sPath & "\" & sTemp
    Else
    Dim Folder : Folder = Mid(sTemp, InStrRev(sTemp, "|") + 1)
    sLine = "|" & Mid(sTemp, 1, InStrRev(sTemp, "|") - 1) & "|"
    sPath = sPath & "\" & Folder
    End If
    oFso.CreateFolder sPath
    If CreateFolder(sLine, sPath) Then CreateFolder = True
    End if
    End If
    Set oFso = Nothing
    End Function

    Function ParentFolder(byVal sPath)
    Dim regEx
    Set regEx = New RegExp
    regEx.Pattern = "^(.*)\\[^\\]*$"
    regEx.Global = True
    regEx.IgnoreCase = True
    ParentFolder = regEx.Replace(sPath, "$1")
    Set regEx = Nothing
    End Function

    Private Function StrToByte(byVal sText)
    For i = 1 To Len(sText)
    StrToByte = StrToByte & ChrB(Asc(Mid(sText, i, 1)))
    Next
    End Function

    Private Function ByteToStr(byVal sByte)
    Dim oStream
    Set oStream = Server.CreateObject("ADODB.Stream")
    oStream.Type = 2
    oStream.Mode = 3
    oStream.Open
    oStream.WriteText sByte
    oStream.Position = 0
    oStream.CharSet = "gb2312"
    oStream.Position = 2
    ByteToStr = oStream.ReadText
    oStream.Close
    Set oStream = Nothing
    End Function

    Private Function ItemToColl
    For i = 0 To itemCount - 1
    If Not Form.Exists(itemName(i)) Then
    Form.Add itemName(i), itemData(i)
    End If
    Next
    End Function

    Private Sub Class_Terminate
    Form.RemoveAll
    Set Form = Nothing
    End Sub
    End Class

    If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
    Rem 建立上传类实例
    Set oUpload = New Upload
    Rem 指定允许上传文件的类型
    oUpload.CheckFields = "|GIF|BMP|JPG|"
    Rem 指定上传文件所存储的相对路径
    oUpload.Folder = "51JS.COM-ZMM/UploadFile"
    Rem 开始上传处理
    oUpload.Start
    If oUpload.Finished Then
    Rem 上传成功,显示上传信息
    Dim sHtml : sHtml = ""
    sHtml = sHtml & ""
    sHtml = sHtml & "

    "
    sHtml = sHtml & "上传表单数据
    "
    sHtml = sHtml & "标题:
    " & oUpload.Form("P_title") & "

    "
    sHtml = sHtml & "类型:
    " & oUpload.Form("P_assort") & "

    "
    sHtml = sHtml & "小图:
    服务器端路径:" & oUpload.Form("P_image_s") & "

    "
    sHtml = sHtml & "中图:
    服务器端路径:" & oUpload.Form("P_image_m") & "

    "
    sHtml = sHtml & "大图:
    服务器端路径:" & oUpload.Form("P_image_b") & "

    "
    sHtml = sHtml & "介绍:
    " & oUpload.Form("P_content") & "
    "
    sHtml = sHtml & "

    "
    sHtml = sHtml & ""
    Response.Write sHtml
    Response.End
    Else
    Rem 上传失败,显示错误信息
    Call ShowMsg(oUpload.ErrMessage, Request.ServerVariables("SCRIPT_NAME"))
    End If
    Rem 对话框提示函数
    Function ShowMsg(byVal sText, byVal sTarget)
    Dim sScript : sScript = ""
    sScript = sScript & "" & vbCrlf & _
    "window.alert('" & sText & "');" & vbCrlf & _
    "window.location.replace('" & sTarget & "');" & vbCrlf & _
    ""
    Response.Write sScript
    Response.End
    End Function
    End If
    %>

    多文件、表单混合上传类

    body {
    margin: 0px;
    border: 0px;
    font-size: 10pt;
    }
    table {
    border-collapse: collapse;
    font-size: 10pt;
    }
    td {
    font-size: 10pt;
    }

    function formCheck(_form) {
    for (var i = 0; i

    " method="post" enctype="multipart/form-data" onsubmit="return formCheck(this);">

    上传功能测试

    标题:
    类型:
    电子
    医疗

    小图:
    中图:
    大图:
    介绍:

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    8.TabPage类

    body {
    background-color: menu;
    }

    #oContainer {
    width: 500px;
    height: 400px;
    }

    var oTabPage = new Object();

    var TabPage = function(_container) {
    this.author = '51JS.COM-ZMM';
    this.version = 'TabPage 1.0';
    this.container = _container;
    this.barHeight = 22;
    this.put_barHeight = function(_height) { return _height; };
    this.get_barHeight = function() { return this.barHeight; };
    this.guideWidth = 82;
    this.put_guideWidth = function(_width) { return _width; };
    this.get_guideWidth = function() { return this.guideWidth; };
    }

    TabPage.prototype = {
    boxInit : function() {
    this.box = (function(_object) {
    var _box = document.createElement('DIV');
    with (_box) {
    style.width = _object.offsetWidth;
    style.height = _object.offsetHeight;
    style.padding = '0px';
    }
    return _box;
    })(this.container);
    this.box.appendChild(this.bar = (function(_height) {
    var _bar = document.createElement('DIV');
    with (_bar) {
    align = 'left';
    style.width = '100%';
    style.height = _height;
    style.padding = '0px';
    attachEvent('oncontextmenu', new Function('return false'));
    attachEvent('onselectstart', new Function('return false'));
    }
    return _bar;
    })(this.barHeight));
    this.box.appendChild(this.page = (function(_height) {
    var _page = document.createElement('DIV');
    with (_page) {
    style.width = '100%';
    style.height = _height;
    style.fontSize = '12px';
    style.textAlign = 'left';
    style.padding = '5px';
    style.borderLeft = '1px solid white';
    style.borderRight = '2px outset';
    style.borderBottom = '2px outset';
    style.backgroundColor = 'menu';
    }
    return _page;
    })(parseInt(this.box.style.height) - this.barHeight));
    this.container.appendChild(this.box);
    },

    addTabPage : function(_guides, _contents) {
    this.guides = [];
    this.contents = [];
    for (var i = 0; i

    标题:

    来源:

    分类: 计算机网络计算机软件

    测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试

    [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

    (0)

    相关推荐

    • php实现仿写CodeIgniter的购物车类

      本文实例讲述了php实现仿写CodeIgniter的购物车类.分享给大家供大家参考.具体如下: 这里仿写CodeIgniter的购物车类 购物车基本功能: 1) 将物品加入购物车 2) 从购物车中删除物品 3) 更新购物车物品信息 [+1/-1] 4) 对购物车物品进行统计    1. 总项目    2. 总数量    3. 总金额 5) 对购物单项物品的数量及金额进行统计 6) 清空购物车 cart.php文件如下:  <?php /** * * @author quanshuidingda

    • python写日志文件操作类与应用示例

      本文实例讲述了python写日志文件操作类与应用.分享给大家供大家参考,具体如下: 项目的开发过程中,日志文件是少不了的,通过写日志文件,可以知道程序运行的情况.特别当部署在生产环境中的时候,这个时候一般不能debug , 当然在有些情况时可以 remote debug (远程debug).那种情况另当别论.还是用通常的写日志的方法,比如在 java 中,经常可以看到 log4j,sf4j,logback等三方组件来写日志. 在python中如何实现呢,其实python 本身也带了日志操作的库.

    • JS实现Cookie读、写、删除操作工具类示例

      本文实例讲述了JS实现Cookie读.写.删除操作工具类.分享给大家供大家参考,具体如下: /*** *读取指定的Cookie值 readCookie("id"); *@param {string} cookieName Cookie名称 */ function readCookie(cookieName) { var theCookie = "" + document.cookie; var ind = theCookie.indexOf(cookieName);

    • 写了几个类,希望对大家有用。

      1.日历 #oContainer { width: 193px; padding: 3px; background-color: menu; border-left: buttonhighlight 1px solid; border-top: buttonhighlight 1px solid; border-right: buttonshadow 1px solid; border-bottom: buttonshadow 2px solid; } .DateTable { font: 10

    • Python面向对象类编写细节分析【类,方法,继承,超类,接口等】

      本文实例讲述了Python面向对象类编写技术细节.分享给大家供大家参考,具体如下: 类代码编写细节 继续学习类.方法和继承. class语句 以下是class语句的一般形式: class <name>(superclass,...): data = value def method(self,...): self.member = value 在class语句内,任何赋值语句都会产生类属性,而且还有特殊名称方法重载运算符.例如,名为__init__的函数会在实例对象构造时调用(如果定义过的话)

    • 自己前几天写的无限分类类

      前一周写的吧,使用中效果还不错. 主要思想来自:http://www.phpobject.net/b...[url=http://www.phpobject.net/blog/read.php?49][/url] 这里就不多解释原理了,直接发代码. PS:这里代码是不能直接使用的,必须结合我的一些其他库类.应该说思想才是最重要的,这里主要提供一种分类的思路. 复制代码 代码如下: <?  /**  --   -- 表的结构 `daxue8_category`  -- CREATE TABLE `

    • 也写一个Ajax.Request类附代码

      目的:因为blog程序里的某些模块需要用到ajax,直接使用prototype.js体积比较大(40多k),而且仅仅用到其中的ajax功能,因此为了减轻下载的负担,又不能改动已经在prototype.js框架下写好的代码,只能是按照prototype的风格,自己写一个ajax类,达到零成本移植框架. 新的ajax类如下: var Ajax = {xmlhttp:function(){ try{ return new ActiveXObject('Msxml2.XMLHTTP'); }catch(

    • 发个自己写的表格操作类(添加,删除,排序,上移,下移)

      *{font-size:14px}button{margin:3px} var mytable=null,mytable2=null; window.onload=function(){ mytable=new CTable("tbl",10); mytable2=new CTable("tbl2",6); } Array.prototype.each=function(f){for(var i=0;i0){ self.swapTr(tr,self.tbl.rows

    • 自己写的java日志类和方法代码分享

      复制代码 代码如下: import java.io.*;import java.text.SimpleDateFormat;import java.util.*;import java.util.logging.Logger; public class AndyLogger{    //The defaulted root path of SSLVPN installation     private static String rootPath = "C:\\temp2"; //va

    • 线路分流自动跳转代码;希望对大家有用!

      本人经过测试非常好用代码一:在要跳转的页面上写上:<script language="JavaScript">var m=50000; var n=Math.floor(Math.random()*m+1)//alert(n);document.write("<iframe  src=http://cnc.5nd.com/test.htm?"+n+"||"+location.search.replace(/\?/g,"

    随机推荐