﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-kxbin-文章分类-javascript</title><link>http://www.blogjava.net/kxbin/category/49739.html</link><description>创出一片天地</description><language>zh-cn</language><lastBuildDate>Wed, 21 Mar 2012 22:08:14 GMT</lastBuildDate><pubDate>Wed, 21 Mar 2012 22:08:14 GMT</pubDate><ttl>60</ttl><item><title>href="#"与href="javascript:void(0)"的区别(转)</title><link>http://www.blogjava.net/kxbin/articles/371084.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Thu, 01 Mar 2012 07:58:00 GMT</pubDate><guid>http://www.blogjava.net/kxbin/articles/371084.html</guid><wfw:comment>http://www.blogjava.net/kxbin/comments/371084.html</wfw:comment><comments>http://www.blogjava.net/kxbin/articles/371084.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kxbin/comments/commentRss/371084.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kxbin/services/trackbacks/371084.html</trackback:ping><description><![CDATA[<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 24px; background-color: #ffffff; ">＃"包含了一个位置信息</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 24px; background-color: #ffffff; ">默认的锚点是＃top 也就是网页的上端<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />而javascript:void(0) 仅仅表示一个死链接<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />这就是为什么有的时候页面很长浏览链接明明是＃可是跳动到了页首<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />而Javascript:void(0) 则不是如此<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />所以调用脚本的时候最好用void(0)<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />或者&lt;input onclick&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;div onclick&gt;等<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />打开新窗口链接的几种办法<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />1.window.open('url')<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />2.用自定义函数<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;script&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function openWin(tag,obj)<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj.target="_blank";<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj.href = "Web/Substation/Substation.aspx?stationno="+tag;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj.click();<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/script&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;a href="javascript:void(0)" onclick="openWin(3,this)"&gt;LINK_TEST&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />window.location.href=""<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />-------------------------------------------------------------------------------<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />如果是个# ，就会出现跳到顶部的情况,个人收藏的几种解决方法：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />1：&lt;a href="####"&gt;&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />2：&lt;a href="javascript:void(0)"&gt;&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />3：&lt;a href="javascript:void(null)"&gt;&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />4：&lt;a href="#" onclick="return false"&gt;&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />5：&lt;span style="cursor:hand"&gt;&lt;/span&gt;(好像在FF中不能显示)<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />-------------------------------------------------------------------------------<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />慎用JavaScript:void(0)<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />今天调试CGI的时候，明明CGI程序已经执行，并且最后结果也是正确的，但是页面就是不刷新。在Firefox2.0下测试，结果却是正常的，IE6却偏偏不刷新！仔细调查了一下，发现cgi页面链接的是 &lt;a href="javaScript:void(0)" OnClick="XXX_Func();" &#8230;.&gt; only a sample &lt;/a&gt;,问题就出在这个void(0)上!让我们先来看看JavaScript中void(0)的含义:<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />JavaScript中void是一个操作符，该操作符指定要计算一个表达式但是不返回值。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />void 操作符用法格式如下：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />1. javascript:void (exPRession)<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />2. javascript:void expression<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />expression是一个要计算的 JavaScript 标准的表达式。表达式外侧的圆括号是可选的，但是写上去是一个好习惯。我们可以使用 void 操作符指定超级链接。表达式会被计算但是不会在当前文档处装入任何内容。面的代码创建了一个超级链接，当用户点击以后不会发生任何事。当用户点击链接时，void(0) 计算为 0，但在 JavaScript 上没有任何效果。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;a href="javascript:void(0)"&gt;单击此处什么也不会发生&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />也就是说，要执行某些处理，但是不整体刷新页面的情况下，可以使用void(0),但是在需要对页面进行refresh的情况下，那就要仔细了。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />其实我们可以这样用&lt;a href="javascript:void(document.form.submit())"&gt;，这句话会进行一次submit操作。那什么情况下用void(0)比较多呢，无刷新，当然是Ajax了，看一下Ajax的web页面的话，一般都会看到有很多的void(0)，：）　，所以在使用void(0)之前,最好先想一想,这个页面是否需要整体刷新。<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />----------------------------------</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 24px; background-color: #ffffff; ">为什么location.href不自动跳转？慎用javascript:void(0)</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 24px; background-color: #ffffff; ">&lt;a href="javascript:void(0)" onclick="delete('123')"&gt;删除&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;script&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />function delete(id) {<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp; if(confirm("确实要删除[为什么location.href不自动跳转？]吗？")) {<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location.href="/delete.jsp?id=" + id;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp; }<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />}<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />以上代码不管如何检查都没有任何问题，而location.href="/delete.jsp?id=" + id;在别的地方都好使，为什么这段代码就行呢？<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />原因是那个void(0)，把代码改成：<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;a href="javascript:delete('123')"&gt;删除&lt;/a&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&lt;script&gt;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />function delete(id) {<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp; if(confirm("确实要删除[为什么location.href不自动跳转？]吗？")) {<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location.href="/delete.jsp?id=" + id;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />&nbsp;&nbsp; }<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />}<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " />我们发现，页面立即就跳转了，能正常删除相应的数据。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #333333; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 24px; background-color: #ffffff; ">void是一个操作符，会计算一个表达式，但不会返回值，当然也不会改变当前页面的任何内容，也就不会正常的跳转</p><img src ="http://www.blogjava.net/kxbin/aggbug/371084.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kxbin/" target="_blank">kxbin</a> 2012-03-01 15:58 <a href="http://www.blogjava.net/kxbin/articles/371084.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态添加新行（在javascript，通过触发事件添加新行）</title><link>http://www.blogjava.net/kxbin/articles/370896.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Tue, 28 Feb 2012 01:41:00 GMT</pubDate><guid>http://www.blogjava.net/kxbin/articles/370896.html</guid><wfw:comment>http://www.blogjava.net/kxbin/comments/370896.html</wfw:comment><comments>http://www.blogjava.net/kxbin/articles/370896.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kxbin/comments/commentRss/370896.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kxbin/services/trackbacks/370896.html</trackback:ping><description><![CDATA[<div>&lt;html&gt;</div><div>&lt;head&gt;</div><div><span style="white-space:pre">	</span>&lt;script&gt;</div><div><span style="white-space:pre">		</span>function test(){</div><div><span style="white-space:pre">			</span>var ls_t = &nbsp; window.document.all("table1"); //获得id为talbe1的对象</div><div><span style="white-space:pre">			</span>var trIndex = window.document.all("tr1");</div><div><span style="white-space:pre">			</span>maxcell=ls_t.rows(0).cells.length;</div><div><span style="white-space:pre">			</span>mynewrow = ls_t.insertRow(); &nbsp;//添加新行</div><div><span style="white-space:pre">			</span>if(!trIndex.value) {</div><div><span style="white-space:pre">				</span>trIndex.value = 0;</div><div><span style="white-space:pre">			</span>}</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; trIndex.value = parseInt(trIndex.value) + 1;</div><div><span style="white-space:pre">			</span>mynewrow.setAttribute("id","tr" + trIndex.value); //添加一个变量为id</div><div><span style="white-space:pre">			</span>mynewcell=mynewrow.insertCell(); &nbsp; //添加新列</div><div><span style="white-space:pre">			</span>mynewcell.setAttribute("align","center");</div><div><span style="white-space:pre">			</span>mynewcell.innerHTML="1";</div><div><span style="white-space:pre">			</span>mynewcell=mynewrow.insertCell();&nbsp;</div><div><span style="white-space:pre">			</span>mynewcell.setAttribute("align","center");</div><div><span style="white-space:pre">			</span>mynewcell.innerHTML="test";</div><div><span style="white-space:pre">			</span>mynewcell=mynewrow.insertCell();&nbsp;</div><div><span style="white-space:pre">			</span>mynewcell.setAttribute("align","center");</div><div><span style="white-space:pre">			</span>mynewcell.innerHTML="25";</div><div><span style="white-space:pre">			</span></div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>&lt;/script&gt;</div><div>&lt;/head&gt;</div><div>&lt;body&gt;</div><div><span style="white-space:pre">	</span>&lt;a href="javascript:test()"&gt;添加新行新列&lt;/a&gt;</div><div><span style="white-space:pre">	</span>&lt;table id="table1" border="1"&gt;</div><div><span style="white-space:pre">		</span>&lt;tr id="tr1"&gt;</div><div><span style="white-space:pre">			</span>&lt;td&gt;序号&lt;/td&gt;</div><div><span style="white-space:pre">			</span>&lt;td&gt;姓名&lt;/td&gt;</div><div><span style="white-space:pre">			</span>&lt;td&gt;年龄&lt;/td&gt;</div><div><span style="white-space:pre">		</span>&lt;/tr&gt;</div><div><span style="white-space:pre">	</span>&lt;/table&gt;</div><div>&lt;/body&gt;</div><div>&lt;/html&gt;</div><img src ="http://www.blogjava.net/kxbin/aggbug/370896.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kxbin/" target="_blank">kxbin</a> 2012-02-28 09:41 <a href="http://www.blogjava.net/kxbin/articles/370896.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript实现页面跳转的几种方式</title><link>http://www.blogjava.net/kxbin/articles/366418.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Thu, 15 Dec 2011 03:57:00 GMT</pubDate><guid>http://www.blogjava.net/kxbin/articles/366418.html</guid><wfw:comment>http://www.blogjava.net/kxbin/comments/366418.html</wfw:comment><comments>http://www.blogjava.net/kxbin/articles/366418.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kxbin/comments/commentRss/366418.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kxbin/services/trackbacks/366418.html</trackback:ping><description><![CDATA[<div><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">第一种：</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; &lt;script language="javascript"&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.location.href="index.<a href="http://www.2cto.com/kf/web/php/" target="_blank" style="color: #333333; text-decoration: none; font-size: 14px; ">php</a>";&nbsp;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //比较常用的方法，没什么可解释的，后面直接跟指定要跳转的地方。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; &lt;/script&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">第二种：</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; &lt;script language="javascript"&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">alert("返回");</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">window.history.back(-1);</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //类似于按钮，参数是负几，就后退几次。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp; &lt;/script&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">第三种：</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp; &lt;script language="javascript"&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">window.navigate("index.<a href="http://www.2cto.com/kf/web/jsp/" target="_blank" style="color: #333333; text-decoration: none; font-size: 14px; ">jsp</a>");</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //navigate对象包含有关<a href="http://www.2cto.com/os/liulanqi/" target="_blank" style="color: #333333; text-decoration: none; font-size: 14px; ">浏览器</a>的信息，也可以作为页面跳转，后面直接加要跳转的地方。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //没有应用于 navigator 对象的公开标准，不过所有浏览器都支持该对象。&nbsp;&nbsp;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; &lt;/script&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">第四种：</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp; &lt;script language="JavaScript"&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.location.href=index.htm;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //self指代当前窗口对象,属于window最上层的对象;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //location.href 指的是某window对象的URL地址.</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //self.location.href指当前窗口的URL地址,去掉self默认为当前窗口的URL地址.</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp; &lt;/script&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">第五种：</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp; &lt;script language="javascript"&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert("非法访问！");</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top.location=index.jsp;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //top 属性返回最顶层的先辈窗口。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //该属性返回队一个顶级窗口的只读引用。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //如果窗口本身就是一个顶级窗口，top 属性存放对窗口自身的引用。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //如果窗口是一个框架，那么 top 属性引用包含框架的顶层窗口。</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; &lt;/script&gt;</p><p style="border-top-width: 0px; padding-right: 0px; padding-left: 0px; border-left-width: 0px; border-bottom-width: 0px; padding-bottom: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; border-right-width: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #333333; font-family: 宋体; font-size: 14px; line-height: 28px; background-color: #ffffff; ">&nbsp;</p></div><img src ="http://www.blogjava.net/kxbin/aggbug/366418.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kxbin/" target="_blank">kxbin</a> 2011-12-15 11:57 <a href="http://www.blogjava.net/kxbin/articles/366418.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在javascript中将GBK转UTF-8</title><link>http://www.blogjava.net/kxbin/articles/366349.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 14 Dec 2011 08:26:00 GMT</pubDate><guid>http://www.blogjava.net/kxbin/articles/366349.html</guid><wfw:comment>http://www.blogjava.net/kxbin/comments/366349.html</wfw:comment><comments>http://www.blogjava.net/kxbin/articles/366349.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kxbin/comments/commentRss/366349.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kxbin/services/trackbacks/366349.html</trackback:ping><description><![CDATA[<div><div style="width: 673px; text-align: left; background-color: #ffffff; "><div><div><div><span style="line-height: 18px;">将GBK编码转化为UTF-8</span></div><div><span style="line-height: 18px;">&lt;script type="text/javascript"&gt; &nbsp;</span></div><div><span style="line-height: 18px;">var easyUTF8 = function(gbk){ &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; if(!gbk){return '';} &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; var utf8 = []; &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; for(var i=0;i&lt;gbk.length;i++){ &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; var s_str = gbk.charAt(i); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; if(!(/^%u/i.test(escape(s_str)))){utf8.push(s_str);continue;} &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; var s_char = gbk.charCodeAt(i); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; var b_char = s_char.toString(2).split(''); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; var c_char = (b_char.length==15)?[0].concat(b_char):b_char; &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; var a_b =[]; &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; a_b[0] = '1110'+c_char.splice(0,4).join(''); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; a_b[1] = '10'+c_char.splice(0,6).join(''); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; a_b[2] = '10'+c_char.splice(0,6).join(''); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; for(var n=0;n&lt;a_b.length;n++){ &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; utf8.push('%'+parseInt(a_b[n],2).toString(16).toUpperCase()); &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; } &nbsp;</span></div><div><span style="line-height: 18px;">&nbsp; &nbsp; return utf8.join(''); &nbsp;</span></div><div><span style="line-height: 18px;">}; &nbsp;</span></div><div><span style="line-height: 18px;">document.write(easyUTF8('我爱北京天安门！')); &nbsp;</span></div><div><span style="line-height: 18px;">&lt;/script&gt; &nbsp;<br /></span></div></div><div style="color: #333333; line-height: 18px; "></div></div></div></div><img src ="http://www.blogjava.net/kxbin/aggbug/366349.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kxbin/" target="_blank">kxbin</a> 2011-12-14 16:26 <a href="http://www.blogjava.net/kxbin/articles/366349.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS树形菜单</title><link>http://www.blogjava.net/kxbin/articles/360039.html</link><dc:creator>kxbin</dc:creator><author>kxbin</author><pubDate>Wed, 05 Oct 2011 10:12:00 GMT</pubDate><guid>http://www.blogjava.net/kxbin/articles/360039.html</guid><wfw:comment>http://www.blogjava.net/kxbin/comments/360039.html</wfw:comment><comments>http://www.blogjava.net/kxbin/articles/360039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/kxbin/comments/commentRss/360039.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/kxbin/services/trackbacks/360039.html</trackback:ping><description><![CDATA[<div style="margin: 0px 0px 15px" class="blog_title">
<h3 style="padding-bottom: 0px; line-height: 1.5em; margin: 0px 0px 0.5em; padding-left: 0px; padding-right: 0px; color: black; font-size: 16px; padding-top: 10px">JS特效代码大全（七）超全的JS树形菜单共享</h3><strong>标签:&nbsp;<a style="color: #006600; text-decoration: underline" href="http://www.oecp.cn/blogs/tag/%E6%A0%91%E5%BD%A2%E8%8F%9C%E5%8D%95/">树形菜单</a>&nbsp;<a style="color: #006600; text-decoration: underline" href="http://www.oecp.cn/blogs/tag/%E7%89%B9%E6%95%88%E4%BB%A3%E7%A0%81/">特效代码</a>&nbsp;<a style="color: #006600; text-decoration: underline" href="http://www.oecp.cn/blogs/tag/js/">js</a>&nbsp;<a style="color: #006600; text-decoration: underline" href="http://www.oecp.cn/blogs/tag/%E6%BA%90%E4%BB%A3%E7%A0%81/">源代码</a>&nbsp;<a style="color: #006600; text-decoration: underline" href="http://www.oecp.cn/blogs/tag/%E4%B8%8B%E8%BD%BD/">下载</a></strong> </div>
<div style="line-height: 26px; font-size: 14px" class="blog_content">
<p>JS树形菜单是很常用的<a style="color: #006600; text-decoration: underline" href="http://www.po-soft.com/blog/xuan/category/42" target="_blank">JS特效代码</a>，常用在管理软件当中，但是一套树形菜单已经不能满足需求，所以如果能有一套比较全面的树形菜单JS特效代码，将会非常方便，下面懒人萱将超全的JS树形菜单（dhtmlxTree）共享出来，相信你一定用得上。</p>
<p>&nbsp;超全的JS树形菜单共享一共包括八种，下面就一一介绍：</p>
<p><strong>1、不同表现方式的JS树形菜单</strong>（如图所示）</p>
<p><img style="vertical-align: top" alt="不同表现方式的JS树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/5abf61e216c2446a8f3d521fc4dfa0f2.gif" width="626" height="215" /></p>
<p><strong>2、复选框式的JS树形菜单</strong>（如图所示）</p>
<p>左图为只可以选择单节点，右图为在选择子节点的同时选择父节点</p>
<p><img style="vertical-align: top" alt="复选框式的JS树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/d39d3bbe76214c5ea913595daffccff6.gif" width="481" height="201" /></p>
<p>3、<strong>可以重新排列节点并且具有拖放功能的js树形菜单</strong>（如图所示）</p>
<p>&nbsp;<img style="vertical-align: top" alt="可以重新排列节点并且具有拖放功能的js树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/858bc9d4b087444b8b787a500eb901d8.gif" width="232" height="344" /></p>
<p>4、<strong>带有提示框的js树形菜单</strong>（如图所示）</p>
<p>　　如果想打开或关闭某个节点，将会弹出一个警告框；如果选中或取消某个菜单前的复选框，也会有相应的文字提示。这个功能目前还没有想到会在什么情况下使用，但是可以先了解一下。</p>
<p>&nbsp;<img style="vertical-align: top" alt="带有提示框的js树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/0f2c69b563d6491188e5e5a535f47f24.gif" width="576" height="219" /></p>
<p>5、<strong>将div菜单列表转换成树的js树形菜单</strong>（如图所示）</p>
<p>　　左图为div菜单列表，右图为转换后的树。</p>
<p><img style="vertical-align: top" alt="将div菜单列表转换成树的js树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/eb42d1b8f0cc4506b16744c85c592e94.gif" width="504" height="118" /></p>
<p>6、<strong>可以异步加载数据的js树形菜单</strong></p>
<p>7、<strong>可以添加和删除菜单的js树形菜单</strong>（如图所示）</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; 包括添加子菜单和同级菜单两种。</p>
<p><img style="vertical-align: top" alt="可以添加和删除菜单的js树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/6e8a7466a9d14fd285df432792ea1485.gif" width="588" height="219" /></p>
<p>8、<strong>展开关闭节点的js树形菜单</strong>（如图所示）</p>
<p><img style="vertical-align: top" alt="展开关闭节点的js树形菜单" src="http://www.oecp.cn/userfiles/image/2009-09/f7c73f128fc044f5838fd7b2bd676fc9.gif" width="401" height="218" /></p>
<p>所有的JS树形菜单源文件在附件下载，里面有以上全部的实例源代码，还有很详细的功能描述及参数设置，不过都是英文的，本人英语很差大家还是自己翻译吧，呵呵！</p>
<p>此JS树形菜单已做过测试，可以兼容现在的所有主流浏览器，所以你可以放心使用这个JS树形菜单。</p>
<p>里边的功能很多，可能大家暂时不会都用到，但是说不定以后会用到呢，所以要好好收藏哦！</p>
<p>好了，JS特效代码大全（七）超全的JS树形菜单共享就这么多了，懒人萱之前还有很多其他JS特效代码文章，也可以下载下来收藏，以后一定有用到的地方，如果其中有什么问题可以留言给<a style="color: #006600; text-decoration: underline" href="http://www.po-soft.com/hi/xuan/blog" target="_blank">懒人萱</a>，尽量给你满意的答复！</p>
<p>&nbsp;</p>
<p>来自：<a href="http://www.oecp.cn/hi/xuan/blog/392"><font color="#108ac6">http://www.oecp.cn/hi/xuan/blog/392</font></a></p></div> <img src ="http://www.blogjava.net/kxbin/aggbug/360039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/kxbin/" target="_blank">kxbin</a> 2011-10-05 18:12 <a href="http://www.blogjava.net/kxbin/articles/360039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>