JQuery文件浏览器插件使用示例

来源:互联网 发布:在淘宝卖鞋需要多少钱 编辑:程序博客网 时间:2024/06/05 23:47

index.jsp:

[java] view plaincopyprint?
  1. <%@page contentType="text/html" pageEncoding="utf-8"%>  
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  3.                        "http://www.w3.org/TR/html4/loose.dtd">  
  4. <!-- jqueryFileTree.jsp上加上了contentType和pageEncoding用于解决读取到的目录或文件名称中文乱码问题 -->  
  5. <html>  
  6.   <head>  
  7.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
  8.     <title>JQuery文件浏览器插件示例</title>  
  9.     <!-- 由 于css和图片没有放在css代码中可读的图片路径下,所在这里的css读取图片路径的代码改成适应本示例路径 -->  
  10.     <link type="text/css" rel="stylesheet" href="style/jqueryFileTree.css" mce_href="style/jqueryFileTree.css"></link>  
  11.     <mce:style type="text/css"><!--  
  12.    
  13.             BODY,  
  14.             HTML {  
  15.                 padding: 0px;  
  16.                 margin: 0px;  
  17.             }  
  18.             BODY {  
  19.                 font-family: Verdana, Arial, Helvetica, sans-serif;  
  20.                 font-size: 11px;  
  21.                 background: #EEE;  
  22.                 padding: 15px;  
  23.             }  
  24.             H2 {  
  25.                 font-family: Georgia, serif;  
  26.                 font-size: 16px;  
  27.                 font-weight: normal;  
  28.                 margin: 0px 0px 10px 0px;  
  29.             }  
  30.               
  31.             .example {  
  32.                 float: center;  
  33.                 margin: 215px;  
  34.             }  
  35.               
  36.             .show {  
  37.                 width: 250px;  
  38.                 height: 600px;  
  39.                 border-top: solid 1px #BBB;  
  40.                 border-left: solid 1px #BBB;  
  41.                 border-bottom: solid 1px #FFF;  
  42.                 border-right: solid 1px #FFF;  
  43.                 background: #FFF;  
  44.                 overflow: scroll;  
  45.                 padding: 5px;  
  46.             }  
  47.           
  48. --></mce:style><style type="text/css" mce_bogus="1">   
  49.             BODY,  
  50.             HTML {  
  51.                 padding: 0px;  
  52.                 margin: 0px;  
  53.             }  
  54.             BODY {  
  55.                 font-family: Verdana, Arial, Helvetica, sans-serif;  
  56.                 font-size: 11px;  
  57.                 background: #EEE;  
  58.                 padding: 15px;  
  59.             }  
  60.             H2 {  
  61.                 font-family: Georgia, serif;  
  62.                 font-size: 16px;  
  63.                 font-weight: normal;  
  64.                 margin: 0px 0px 10px 0px;  
  65.             }  
  66.               
  67.             .example {  
  68.                 float: center;  
  69.                 margin: 215px;  
  70.             }  
  71.               
  72.             .show {  
  73.                 width: 250px;  
  74.                 height: 600px;  
  75.                 border-top: solid 1px #BBB;  
  76.                 border-left: solid 1px #BBB;  
  77.                 border-bottom: solid 1px #FFF;  
  78.                 border-right: solid 1px #FFF;  
  79.                 background: #FFF;  
  80.                 overflow: scroll;  
  81.                 padding: 5px;  
  82.             }  
  83.         </style>   
  84.       
  85.     <mce:script type="text/javascript" src="js/jquery-1.4.2.min.js" mce_src="js/jquery-1.4.2.min.js"></mce:script>  
  86.     <!-- 打开和关闭文件夹时的动画效果要依赖下面的两个js库 -->  
  87.     <mce:script type="text/javascript" src="js/jquery.easing.1.3.js" mce_src="js/jquery.easing.1.3.js"></mce:script>  
  88.     <mce:script type="text/javascript" src="js/jquery.easing.compatibility.js" mce_src="js/jquery.easing.compatibility.js"></mce:script>  
  89.     <mce:script type="text/javascript" src="js/jqueryFileTree.js" mce_src="js/jqueryFileTree.js"></mce:script>  
  90.     <mce:script type="text/javascript"><!--  
  91.         $(document).ready( function() {  
  92.             $('#show').fileTree({  
  93.                 root: 'E:/',//指定加载文件的路径  
  94.                 script: 'jqueryFileTree.jsp',  
  95.                 expandSpeed: 750,  
  96.                 collapseSpeed: 750,  
  97.                 multiFolder: false,  
  98.                 expandEasing: 'easeOutBounce'//打开时的动画效果  
  99.                 collapseEasing: 'easeOutBounce',//关闭时的动画效果  
  100.                 loadMessage:'正在加载中...'  
  101.             }, function(file) {  
  102.                 //点击文件后的回调函数,自己可实现要的逻辑  
  103.                 alert(file);  
  104.             });  
  105.         });  
  106.       
  107. // --></mce:script>  
  108.   </head>  
  109.   <body>  
  110.     <div class="example">   
  111.             <h2>JQuery文件浏览器插件示例</h2>   
  112.             <div id="show" class="show"></div>   
  113.     </div>   
  114.   </body>  
  115. </html>   
 

 

 

0 0
原创粉丝点击