- 浏览: 45566 次
- 性别:
- 来自: 深圳
-
文章分类
最新评论
-
chinadeng:
数据库缓存是构架在hibernate之上的,是一个只有794行 ...
开发实战:舍得网44587行代码开发经验 -
小金哥:
谢过!
Ext 3.3 中文.CHM
打开模式对话框
返回模式对话框的值
全屏幕打开 IE 窗口
脚本中中使用xml
一、验证类
1、数字验证内
2、时间类
3、表单类
4、字符类
5、浏览器类
6、结合类
二、功能类
1、时间与相关控件类
2、表单类
3、打印类
4、事件类
5、网页设计类
6、树型结构。
7、无边框效果的制作
8、连动下拉框技术
9、文本排序
10,画图类,含饼、柱、矢量贝滋曲线
11,操纵客户端注册表类
12,DIV层相关(拖拽、显示、隐藏、移动、增加)
13,TABLAE相关(客户端动态增加行列,模拟进度条,滚动列表等)
14,各种object classid=>相关类,如播放器,flash与脚本互动等
16, 刷新/模拟无刷新 异步调用类(XMLHttp或iframe,frame)
一个可以在页面上随意画线、多边形、圆,填充等功能的js (part 2)
function mkOv2D(left, top, width, height) { var s = this.stroke; width += s-1; height += s-1; var a = width>>1, b = height>>1, wod = width&1, hod = (height&1)+1, cx = left+a, cy = top+b, x = 0, y = b, aa = (a*a)<<1, bb = (b*b)<<1, st = (aa>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa*((b<<1)-1); if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0)) { var ox = 0, oy = b, w, h, pxl, pxr, pxt, pxb, pxw; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - (aa<<1)*(y-1); tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); w = x-ox; h = oy-y; if (w-1) { pxw = w+1+(s&1); h = s; } else if (h-1) { pxw = s; h += 1+(s&1); } else pxw = h = s; this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h); ox = x; oy = y; } else { tt -= aa*((y<<1)-3); st -= (aa<<1)*(--y); } } this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod); this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod); } else { var _a = (width-((s-1)<<1))>>1, _b = (height-((s-1)<<1))>>1, _x = 0, _y = _b, _aa = (_a*_a)<<1, _bb = (_b*_b)<<1, _st = (_aa>>1)*(1-(_b<<1)) + _bb, _tt = (_bb>>1) - _aa*((_b<<1)-1), pxl = new Array(), pxt = new Array(), _pxb = new Array(); pxl[0] = 0; pxt[0] = b; _pxb[0] = _b-1; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); pxl[pxl.length] = x; pxt[pxt.length] = y; } else if (tt < 0) { st += bb*((x<<1)+3) - (aa<<1)*(y-1); tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); pxl[pxl.length] = x; pxt[pxt.length] = y; } else { tt -= aa*((y<<1)-3); st -= (aa<<1)*(--y); } if (_y > 0) { if (_st < 0) { _st += _bb*((_x<<1)+3); _tt += (_bb<<1)*(++_x); _pxb[_pxb.length] = _y-1; } else if (_tt < 0) { _st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1); _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3); _pxb[_pxb.length] = _y-1; } else { _tt -= _aa*((_y<<1)-3); _st -= (_aa<<1)*(--_y); _pxb[_pxb.length-1]--; } } } var ox = 0, oy = b, _oy = _pxb[0], l = pxl.length, w, h; for (var i = 0; i < l; i++) { if (typeof _pxb[i] != "undefined") { if (_pxb[i] < _oy || pxt[i] < oy) { x = pxl[i]; this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy); ox = x; oy = pxt[i]; _oy = _pxb[i]; } } else { x = pxl[i]; this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod); this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); ox = x; oy = pxt[i]; } } this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod); this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); } } function mkOvDott(left, top, width, height) { var a = width>>1, b = height>>1, wod = width&1, hod = height&1, cx = left+a, cy = top+b, x = 0, y = b, aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, st = (aa2>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa2*((b<<1)-1), drw = true; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - aa4*(y-1); tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); } else { tt -= aa2*((y<<1)-3); st -= aa4*(--y); } if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1); drw = !drw; } } 一个可以在页面上随意画线、多边形、圆,填充等功能的js (part 3) function mkRect(x, y, w, h) { var s = this.stroke; this.mkDiv(x, y, w, s); this.mkDiv(x+w, y, s, h); this.mkDiv(x, y+h, w+s, s); this.mkDiv(x, y+s, s, h-s); } function mkRectDott(x, y, w, h) { this.drawLine(x, y, x+w, y); this.drawLine(x+w, y, x+w, y+h); this.drawLine(x, y+h, x+w, y+h); this.drawLine(x, y, x, y+h); } function jsgFont() { this.PLAIN = 'font-weight:normal;'; this.BOLD = 'font-weight:bold;'; this.ITALIC = 'font-style:italic;'; this.ITALIC_BOLD = this.ITALIC + this.BOLD; this.BOLD_ITALIC = this.ITALIC_BOLD; } var Font = new jsgFont(); function jsgStroke() { this.DOTTED = -1; } var Stroke = new jsgStroke(); function jsGraphics(id, wnd) { this.setColor = new Function('arg', 'this.color = arg.toLowerCase();'); this.setStroke = function(x) { this.stroke = x; if (!(x+1)) { this.drawLine = mkLinDott; this.mkOv = mkOvDott; this.drawRect = mkRectDott; } else if (x-1 > 0) { this.drawLine = mkLin2D; this.mkOv = mkOv2D; this.drawRect = mkRect; } else { this.drawLine = mkLin; this.mkOv = mkOv; this.drawRect = mkRect; } }; this.setPrintable = function(arg) { this.printable = arg; if (jg_fast) { this.mkDiv = mkDivIe; this.htmRpc = arg? htmPrtRpc : htmRpc; } else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv; }; this.setFont = function(fam, sz, sty) { this.ftFam = fam; this.ftSz = sz; this.ftSty = sty || Font.PLAIN; }; this.drawPolyline = this.drawPolyLine = function(x, y, s) { for (var i=0 ; i<x.length-1 ; i++ ) this.drawLine(x[i], y[i], x[i+1], y[i+1]); }; this.fillRect = function(x, y, w, h) { this.mkDiv(x, y, w, h); }; this.drawPolygon = function(x, y) { this.drawPolyline(x, y); this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]); }; this.drawEllipse = this.drawOval = function(x, y, w, h) { this.mkOv(x, y, w, h); }; this.fillEllipse = this.fillOval = function(left, top, w, h) { var a = (w -= 1)>>1, b = (h -= 1)>>1, wod = (w&1)+1, hod = (h&1)+1, cx = left+a, cy = top+b, x = 0, y = b, ox = 0, oy = b, aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, st = (aa2>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa2*((b<<1)-1), pxl, dw, dh; if (w+1) while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - aa4*(y-1); pxl = cx-x; dw = (x<<1)+wod; tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); dh = oy-y; this.mkDiv(pxl, cy-oy, dw, dh); this.mkDiv(pxl, cy+oy-dh+hod, dw, dh); ox = x; oy = y; } else { tt -= aa2*((y<<1)-3); st -= aa4*(--y); } } this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod); }; this.fillPolygon = function(array_x, array_y) { var i; var y; var miny, maxy; var x1, y1; var x2, y2; var ind1, ind2; var ints; var n = array_x.length; if (!n) return; miny = array_y[0]; maxy = array_y[0]; for (i = 1; i < n; i++) { if (array_y[i] < miny) miny = array_y[i]; if (array_y[i] > maxy) maxy = array_y[i]; } for (y = miny; y <= maxy; y++) { var polyInts = new Array(); ints = 0; for (i = 0; i < n; i++) { if (!i) { ind1 = n-1; ind2 = 0; } else { ind1 = i-1; ind2 = i; } y1 = array_y[ind1]; y2 = array_y[ind2]; if (y1 < y2) { x1 = array_x[ind1]; x2 = array_x[ind2]; } else if (y1 > y2) { y2 = array_y[ind1]; y1 = array_y[ind2]; x2 = array_x[ind1]; x1 = array_x[ind2]; } else continue; if ((y >= y1) && (y < y2)) polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); else if ((y == maxy) && (y > y1) && (y <= y2)) polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); } polyInts.sort(integer_compare); for (i = 0; i < ints; i+=2) { w = polyInts[i+1]-polyInts[i] this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1); } } }; this.drawString = function(txt, x, y) { this.htm += '<div style="position:absolute;white-space:nowrap;'+ 'left:' + x + 'px;'+ 'top:' + y + 'px;'+ ' this.ftFam + ';'+ 'font-size:' + this.ftSz + ';'+ 'color:' + this.color + ';' + this.ftSty + '">'+ txt + '<\/div>'; } this.drawImage = function(imgSrc, x, y, w, h) { this.htm += '<div style="position:absolute;'+ 'left:' + x + 'px;'+ 'top:' + y + 'px;'+ 'width:' + w + ';'+ 'height:' + h + ';">'+ '<img src="' + imgSrc + '" width="' + w + '" height="' + h + '">'+ '<\/div>'; } this.clear = function() { this.htm = ""; if (this.cnv) this.cnv.innerHTML = this.defhtm; }; this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h) { this.mkDiv(xr+cx, yt+cy, w, h); this.mkDiv(xr+cx, yb+cy, w, h); this.mkDiv(xl+cx, yb+cy, w, h); this.mkDiv(xl+cx, yt+cy, w, h); }; this.setStroke(1); this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN); this.color = '#000000'; this.htm = ''; this.wnd = wnd || window; if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM(); if (typeof id != 'string' || !id) this.paint = pntDoc; else { this.cnv = document.all? (this.wnd.document.all[id] || null) : document.getElementById? (this.wnd.document.getElementById(id) || null) : null; this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : ''; this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv; } this.setPrintable(false); } function integer_compare(x,y) { return (x < y) ? -1 : ((x > y)*1); } JS 中,一些东西不可用的三种展现方式。 我们在WEB项目中,有时候需要在用户点击某个东西的时候,一些东西不可用。如果在客户端实现。最简单的就是利用disabled 。下面罗列的其中三种方式:依次是:不可用(disabled);用一个空白来代替这个地方(Blank);这个区域为空(None)。具体可以查看这个Blog的源文件: obj.disabled = false; obj.style.visibility = "hidden"; obj.style.display = "none"; <SCRIPT language=javascript> function ShowDisableObject(obj) { if(obj.disabled == false) { obj.disabled = true; } else{ obj.disabled = false; } var coll = obj.all.tags("INPUT"); if (coll!=null) { for (var i=0; i<coll.length; i++) { coll[i].disabled = obj.disabled; } } } function ShowBlankObject(obj) { if(obj.style.visibility == "hidden") { obj.style.visibility = "visible"; } else { obj.style.visibility = "hidden"; } } function ShowNoneObject(obj) { if(obj.style.display == "none") { obj.style.display = "block"; } else { obj.style.display = "none"; } } </SCRIPT> <P></P> <DIV id=Show01>dadd <DIV>ccc</DIV><INPUT> <INPUT type=checkbox> </DIV> <P><INPUT onclick=ShowDisableObject(Show01); type=button value=Disable> <INPUT id=Button1 onclick=ShowBlankObject(Show01); type=button value=Blank name=Button1> <INPUT id=Button2 onclick=ShowNoneObject(Show01); type=button value=None name=Button2> </P><!--演示代码结束//--> On this page I explain a simple DHTML example script that features invisibility, moving and the changing of text colour. Example Test TextMake test text invisible. Make test text visible. Move test text 50 pixels down. Move test text 50 pixels up. Change colour to red. Change colour to blue. Change colour to black. Change the font style to italic. Change the font style to normal. Change the font family to 'Times'. Change the font family to 'Arial'. The script The scripts work on this HTML element: <DIV ID="text">Test Text</DIV> #text {position: absolute; top: 400px; left: 400px; font: 18px arial; font-weight: 700; } These scripts are necessary for the three effects: var DHTML = (document.getElementById || document.all || document.layers); function getObj(name) { if (document.getElementById) { this.obj = document.getElementById(name); this.style = document.getElementById(name).style; } else if (document.all) { this.obj = document.all[name]; this.style = document.all[name].style; } else if (document.layers) { this.obj = document.layers[name]; this.style = document.layers[name]; } } function invi(flag) { if (!DHTML) return; var x = new getObj('text'); x.style.visibility = (flag) ? 'hidden' : 'visible' } var texttop = 400; function move(amount) { if (!DHTML) return; var x = new getObj('text'); texttop += amount; x.style.top = texttop; } function changeCol(col) { if (!DHTML) return; var x = new getObj('text'); x.style.color = col; } 一段实现DataGrid的“编辑”、“取消”功能脚本,目的是不产生页面刷新 <SCRIPT language="javascript"> var selectRow=""; var selectObject; function EditCell(thisObject,type) { var id = thisObject.id; var buttonID="Button"+type; var row=id.replace(buttonID,""); if(type==1&&selectRow.length>0&&selectObject!=null) { EditRow(selectRow,2,selectObject); selectRow=""; } if(type==1){selectRow=row;selectObject=thisObject;}else{selectRow="";selectObject=null;} EditRow(row,type,thisObject); } function EditRow(row,type,thisObject) { var visible1="none"; var visible2="inline"; if(type!=1) { visible1="inline"; visible2="none"; } var buttonID="Button"+type; var style; var i; for(i=1;i<8;i++) { var name1=row+"Img"+i; document.all[name1].getAttribute("style").display=visible1; name1=row+"Text"+i; var name2=row+"Checkbox"+i; document.all[name2].getAttribute("style").display=visible2; if(type!=1) { if(document.all[name1].value==1) document.all[name2].checked=true; else document.all[name2].checked=false; } } var tdIndex = thisObject.parentElement.cellIndex; if(type>1) tdIndex = tdIndex -1; thisObject.parentElement.parentElement.cells[tdIndex].getAttribute("style").display=visible2; thisObject.parentElement.colSpan=type; var name; name=row+buttonID; document.all[name].getAttribute("style").display="none"; if(type==1) { document.all[name].parentElement.parentElement.getAttribute("style").backgroundColor="LightYellow"; name=row+"Button2"; document.all[name].getAttribute("style").display="inline"; } else { document.all[name].parentElement.parentElement.getAttribute("style").backgroundColor=""; name=row+"Button1"; document.all[name].getAttribute("style").display="inline"; } } </SCRIPT> <asp:datagrid id="GridItem" runat="server" cellPadding="0" BorderStyle="Solid" AutoGenerateColumns="False" Width="100%" AllowPaging="True"> <SelectedItemStyle BackColor="LightYellow"></SelectedItemStyle> <EditItemStyle CssClass="tdbg-dark" BackColor="Ivory"></EditItemStyle> <ItemStyle HorizontalAlign="Center" Height="23px" CssClass="tdbg"></ItemStyle> <HeaderStyle HorizontalAlign="Center" Height="25px" CssClass="summary-title"></HeaderStyle> <Columns> <asp:BoundColumn DataField="id" ReadOnly="True" HeaderText="人员编号"> <HeaderStyle Width="120px"></HeaderStyle> </asp:BoundColumn> <asp:BoundColumn ReadOnly="True" HeaderText="姓名"> <HeaderStyle Width="120px"></HeaderStyle> </asp:BoundColumn> <asp:TemplateColumn HeaderText="管理权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img1" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox1" style="DISPLAY: none" type="checkbox" runat="server"> <INPUT id="Text1" type="text" runat="server" style="DISPLAY: none"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="查询权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img2" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox2" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox2"> <INPUT id="Text2" type="text" runat="server" style="DISPLAY: none" NAME="Text2"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="录入权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img3" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox3" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox3"> <INPUT id="Text3" type="text" runat="server" style="DISPLAY: none" NAME="Text3"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="修改权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img4" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox4" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox4"> <INPUT id="Text4" type="text" runat="server" style="DISPLAY: none" NAME="Text4"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="删除权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img5" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox5" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox5"> <INPUT id="Text5" type="text" runat="server" style="DISPLAY: none" NAME="Text5"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="导出权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img6" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox6" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox6"> <INPUT id="Text6" type="text" runat="server" style="DISPLAY: none" NAME="Text6"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="导入权"> <HeaderStyle Width="60px"></HeaderStyle> <ItemTemplate> <IMG id="Img7" style="DISPLAY: inline" alt="" src=http://chinaitpower.com/A200507/2005-07-27/"Images/CheckBoxUnSelect.gif" runat="server"><INPUT id="Checkbox7" style="DISPLAY: none" type="checkbox" runat="server" NAME="Checkbox7"> <INPUT id="Text7" type="text" runat="server" style="DISPLAY: none" NAME="Text7"> </ItemTemplate> </asp:TemplateColumn> <asp:ButtonColumn Text="保存" HeaderText="操作" CommandName="cmdSave"> <ItemStyle Font-Size="10pt"></ItemStyle> </asp:ButtonColumn> <asp:TemplateColumn> <ItemTemplate> <INPUT id="Button1" style="cursor: hand; WIDTH: 35px; COLOR: blue; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline; BORDER-BOTTOM-STYLE: none" onclick="EditCell(this,1);" type="button" value="编辑" runat="server"><INPUT id="Button2" style="cursor: hand; DISPLAY: none; COLOR: blue; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline; BORDER-BOTTOM-STYLE: none" onclick="EditCell(this,2);" type="button" value="取消" runat="server"> </ItemTemplate> </asp:TemplateColumn> </Columns> <PagerStyle NextPageText="下一页" PrevPageText="上一页"></PagerStyle> </asp:datagrid> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> DSTree </TITLE> <META NAME="Author" CONTENT="sTarsjz@hotmail.com" > <style> body,td{font:12px verdana} #treeBox{background-color:#fffffa;} #treeBox .ec{margin:0 5 0 5;} #treeBox .hasItems{font-weight:bold;height:20px;padding:3 6 0 6;margin:2px;cursor:hand;color:#555555;border:1px solid #fffffa;} #treeBox .Items{height:20px;padding:3 6 0 6;margin:1px;cursor:hand;color:#555555;border:1px solid #fffffa;} </style> <base href="http://vip.5d.cn/star/dstree/" _fcksavedurl=""http://vip.5d.cn/star/dstree/"" _fcksavedurl=""http://vip.5d.cn/star/dstree/"" /> <script> //code by star 20003-4-7 var HC = "color:#990000;border:1px solid #cccccc"; var SC = "background-color:#efefef;border:1px solid #cccccc;color:#000000;"; var IO = null; function initTree(){ var rootn = document.all.menuXML.documentElement; var sd = 0; document.onselectstart = function(){return false;} document.all.treeBox.appendChild(createTree(rootn,sd)); } function createTree(thisn,sd){ var nodeObj = document.createElement("span"); var upobj = document.createElement("span"); with(upobj){ style.marginLeft = sd*10; className = thisn.hasChildNodes()?"hasItems":"Items"; innerHTML = "<img src=/Article/UploadPic/2005-11/20051115154649577.gif class=ec>" + thisn.getAttribute("text") +""; onmousedown = function(){ if(event.button != 1) return; if(this.getAttribute("cn")){ this.setAttribute("open",!this.getAttribute("open")); this.cn.style.display = this.getAttribute("open")?"inline":"none"; this.all.tags("img")[0].src = this.getAttribute("open")?"/Article/UploadPic/2005-11/20051115154649577.gif":"/Article/UploadPic/2005-11/20051115154649577.gif"; } if(IO){ IO.runtimeStyle.cssText = ""; IO.setAttribute("selected",false); } IO = this; this.setAttribute("selected",true); this.runtimeStyle.cssText = SC; } onmouseover = function(){ if(this.getAttribute("selected"))return; this.runtimeStyle.cssText = HC; } onmouseout = function(){ if(this.getAttribute("selected"))return; this.runtimeStyle.cssText = ""; } oncontextmenu = contextMenuHandle; onclick = clickHandle; } if(thisn.getAttribute("treeId") != null){ upobj.setAttribute("treeId",thisn.getAttribute("treeId")); } if(thisn.getAttribute("href") != null){ upobj.setAttribute("href",thisn.getAttribute("href")); } if(thisn.getAttribute("target") != null){ upobj.setAttribute("target",thisn.getAttribute("target")); } nodeObj.appendChild(upobj); nodeObj.insertAdjacentHTML("beforeEnd","<br/>") if(thisn.hasChildNodes()){ var i; var nodes = thisn.childNodes; var cn = document.createElement("span"); upobj.setAttribute("cn",cn); if(thisn.getAttribute("open") != null){ upobj.setAttribute("open",(thisn.getAttribute("open")=="true")); upobj.getAttribute("cn").style.display = upobj.getAttribute("open")?"inline":"none"; if( !upobj.getAttribute("open"))upobj.all.tags("img")[0].src ="/Article/UploadPic/2005-11/20051115154649577.gif"; } for(i=0;i<nodes.length;cn.appendChild(createTree(nodes[i++],sd+1))); nodeObj.appendChild(cn); } else{ upobj.all.tags("img")[0].src ="/Article/UploadPic/2005-11/20051115154649577.gif"; } return nodeObj; } window.onload = initTree; </script> <script> function clickHandle(){ // your code here } function contextMenuHandle(){ event.returnValue = false; var treeId = this.getAttribute("treeId"); // your code here } </script> </HEAD> <BODY> <xml id=menuXML> <?xml version="1.0" encoding="GB2312"?> <DSTreeRoot text="根节点" open="true" href="http://"; treeId="123"> <DSTree text="技术论坛" open="false" treeId=""> <DSTree text="5DMedia" open="false" href="http://"; target="box" treeId="12"> <DSTree text="网页编码" href="http://"; target="box" treeId="4353" /> <DSTree text="手绘" href="http://"; target="box" treeId="543543" /> <DSTree text="灌水" href="http://"; target="box" treeId="543543" /> </DSTree> <DSTree text="BlueIdea" open="false" href="http://"; target="box" treeId="213"> <DSTree text="DreamWeaver & JS" href="http://"; target="box" treeId="4353" /> <DSTree text="FlashActionScript" href="http://"; target="box" treeId="543543" /> </DSTree> <DSTree text="CSDN" open="false" href="http://"; target="box" treeId="432"> <DSTree text="JS" href="http://"; target="box" treeId="4353" /> <DSTree text="XML" href="http://"; target="box" treeId="543543" /> </DSTree> </DSTree> <DSTree text="资源站点" open="false" treeId=""> <DSTree text="素材屋" href="http://"; target="box" treeId="12" /> <DSTree text="桌面城市" open="false" href="http://"; target="box" treeId="213"> <DSTree text="壁纸" href="http://"; target="box" treeId="4353" /> <DSTree text="字体" href="http://"; target="box" treeId="543543" /> </DSTree> <DSTree text="MSDN" open="false" href="http://"; target="box" treeId="432"> <DSTree text="DHTML" href="http://"; target="box" treeId="4353" /> <DSTree text="HTC" href="http://"; target="box" treeId="543543" /> <DSTree text="XML" href="" target="box" treeId="2312" /> </DSTree> </DSTree> </DSTreeRoot> </xml> <table style="position:absolute;left:100;top:100;"> <tr><td id=treeBox style="width:400px;height:200px;border:1px solid #cccccc;padding:5 3 3 5;" valign=top></td></tr> <tr><td style="font:10px verdana;color:#999999" align=right>by <font color=#660000>sTar</font><br/> 2003-4-8</td></tr> </table> </BODY> </HTML>
发表评论
-
HTML5与jQuery组合:Web开发教程实践
2011-12-22 13:20 1017【IT168 技术】HTML5 和jQu ... -
CSS兼容IE6,IE7,FF的技巧
2011-07-06 15:09 1005一、CSS HACK以下两种方 ... -
实用javaScript技术总结 (极品收藏)
2011-07-06 15:07 1164实用javaScript技术总结(1):屏蔽类 http:// ... -
javascript 常用代码大全(强烈推荐)(1)
2011-07-06 15:04 1446打开模式对话框 返回模式对话框的值 全屏幕打开 IE 窗口脚本 ... -
javascript 常用代码大全(超级收藏,强烈推荐)(3)
2011-07-06 14:48 826打开模式对话框 返回模式对话框的值 全屏幕打开 IE 窗口脚本 ... -
javascript 常用代码大全(超级收藏,强烈推荐)
2011-07-06 14:45 704全屏幕打开 IE 窗口脚本中中使用xml 一、验证类 1、数字 ... -
JQuery网页换肤
2011-05-10 13:25 1893现在介绍网页换肤 的例子已经数不胜数,自己也没有仔细研究 ... -
tableview
2010-12-24 01:36 638http://www.ideawu.net/person/ta ... -
jQuery combox插件
2010-12-07 23:37 874jquery combox 插件
相关推荐
javascript 常用代码大全.........................
在"Javascript特效代码大全"这个资源中,程序员可以找到许多实用的JavaScript代码示例,帮助提升网页的用户体验和视觉吸引力。 1. **基础概念**: JavaScript主要运行在浏览器环境中,通过DOM(文档对象模型)操作...
这份"JavaScript 源代码大全"集合了多种常用、实用和特效的代码,旨在为开发者提供丰富的参考资料和实践示例。 一、JavaScript基础概念 JavaScript是一种解释型的、面向对象的、弱类型的脚本语言,主要用于网页和...
### JavaScript代码常用大全知识点解析 #### 一、验证类 **1. 数字验证** - **1.1 整数验证** - 目的是确保输入的字符串仅包含整数。 - 可以通过正则表达式 `/^-?\d+$/.test(str)` 实现,其中 `-?` 表示可选的...
"javascript常用代码及汇总"这个资源集合了JavaScript编程中的一些常见用法和实用技巧,是开发者学习和工作中的一大助力。 首先,JavaScript的核心概念包括变量、数据类型、控制结构、函数、数组、对象等。变量是...
这个压缩包包含四个文档,分别命名为"Javascript代码收藏大全1.doc"至"Javascript代码收藏大全4.doc",很可能是按主题或功能分类的不同代码集合。 首先,让我们探讨一下JavaScript的基础知识点: 1. 变量与数据...
这个压缩包文件“JavaScript大全 常用JS效果代码”显然包含了一系列实用的JavaScript代码片段,旨在帮助开发者快速实现常见的网页特效和功能。 1. **JS特效**:JavaScript能够创造出丰富的用户体验,如滑动门、轮播...
JavaScript 是一种广泛应用于 Web 开发中的脚本语言,下面是常用的 JavaScript 案例大全,包括原生 JavaScript 实现字符串长度截取、获取域名主机、清除空格、替换全部、转义 HTML 标签、还原 HTML 标签、时间日期...
javascript常用方法,javascript常用判断,javascript实用命令,javascript常用函数集,javascript常用55个技巧,javascript深度剖析,107个常用的javascript语句.
2. 净化:去掉 Javascript 代码里面的换行、空格、制表符、注释等对于机器无用代码,这样能够压缩 Javascript 文件的体积,节省服务器的带宽。 3. 压缩:通过一定的算法将 Javascript 代码压缩得更小,能够进一步...
7. **实用工具**:在“JavaScript代码大全”中,可能会包含一些常用的工具函数,如数组操作方法(如map、filter、reduce)、字符串处理函数、日期和时间处理,以及错误处理等。这些工具函数能提高代码的可读性和效率...
Javascript特效代码大全,Javascript,Javascript代码,Javascript前端代码
"常用JavaScript特效代码"这个资源集合,显然是一份宝贵的前端开发参考资料,包含了多种常见的JavaScript特效实现。 1. **动画效果**:JavaScript可以创建平滑的页面滚动、淡入淡出图像、滑动门、旋转木马等动画...
JavaScript Obfuscator是一种工具,主要用于保护JavaScript代码,通过将源代码转换为难以理解的形式,以防止未经授权的用户查看、修改或盗窃代码。在Web开发中,尤其对于那些包含商业逻辑或者敏感信息的JavaScript...
这篇博客"JavaScript 常用功能代码"可能是分享了一些实用的JavaScript代码片段和工具,帮助开发者更高效地进行前端开发。标签“源码”和“工具”暗示了内容可能包含代码示例和在线工具。 在JavaScript开发中,有几...
在这个"javascript 400 常用 实例 特效 源代码"压缩包中,包含了丰富的JavaScript编程示例,旨在帮助开发者深入理解和应用JavaScript的各种功能。以下是这些实例和特效所涉及的主要知识点: 1. **页面元素操作**:...
Javascript编程宝典代码 Javascript编程宝典代码 Javascript编程宝典代码 Javascript编程宝典代码
"JS常用代码大全.pdf" 汇集了JavaScript中的常见函数及对象的实例代码,旨在帮助不同水平的学习者理解和掌握JavaScript的核心概念。 1. **基础语法** JavaScript的基础语法包括变量声明(`var`, `let`, `const`)...
JavaScript 事件处理 常用事件(鼠标事件、键盘事件、表单事件)示例代码JavaScript 事件处理 常用事件(鼠标事件、键盘事件、表单事件)示例代码JavaScript 事件处理 常用事件(鼠标事件、键盘事件、表单事件)示例...