How to direct link in js-tree to webpages / files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rob (SA)
    Lieutenant Colonel

    • Nov 2006
    • 586

    How to direct link in js-tree to webpages / files

    Hi Folks,

    I am trying to get link files to my jstree that when i click on the folder the specific file opens.

    My example page at http://oryan-projects.com/liviero/jstree.html

    When I select index it should open up a power point presentation.

    I have copied the files and script below, perhaps you can advise?

    HTML Code:
    <?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>    <title>jQuery Custom Events</title>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        <style type="text/css">        body         {background: #fefefe; color: #111; font: 12px Arial, Helvetica, sans-serif;}                #tree    {color: #333; line-height: 14px}                    .directory     {list-style-image: url('images/directory.png');}            .css         {list-style-image: url('images/css.png');}            .html         {list-style-image: url('images/html.png');}            .js            {list-style-image: url('images/js.png');}            .gif,             .png,            .jpg         {list-style-image: url('images/image.png');}    </style>    </head><body>        <ul id="tree">        <li>root/            <ul>                <li><a href="javascript:popupwnd('http://www.oryan-projects.com/JUST A GARDEN.ppt','no','no','no','no','no','no','','','','')" target="_self">index.html</a></li>                                <li>about.html</li>                <li>gallery.html</li>                <li>contact.html</li>                <li>assets/                    <ul>                        <li>http://www.vodahost.com/vodatalk/images/                            <ul>                                <li>logo.png</li>                                <li>background.jpg</li>                            </ul>                        </li>                        <li>js/                            <ul>                                <li>jquery.js</li>                                <li>myscript.js</li>                            </ul>                        </li>                        <li>css/                            <ul>                                <li>page.css</li>                                <li>typography.css</li>                            </ul>                                            </li>                    </ul>                </li>            </ul>        </li>            </ul>    More script and css style: <a href="http://www.htmldrive.net/" title="HTML DRIVE - Free DHMTL Scripts,Jquery plugins,Javascript,CSS,CSS3,Html5 Library">www.htmldrive.net </a>    <script type="text/javascript" src="http://google.com/jsapi"></script>    <script type="text/javascript">        google.load("jquery", "1");        google.setOnLoadCallback(function() {            $(function() {                addIcons(); 
                    $("#tree li:parent").bind("collapse.TreeEvent", function(evt) {                     if(evt.target == evt.currentTarget)                     {                        $(evt.target).children().slideUp().end().addClass("collapsed");                    }                }).bind("expand.TreeEvent", function(evt) {                    if(evt.target == evt.currentTarget)                    {                        $(evt.target).children().slideDown().end().removeClass("collapsed");                    }                }).toggle(function() {                    $(this).trigger("collapse.TreeEvent");                }, function() {                    $(this).trigger("expand.TreeEvent");                });            });                        function addIcons()            {                $("#tree li").each(function() {                    if($(this).children("ul").length)                    {                        $(this).addClass("directory");                    }                    else                    {                        var txt = $(this).text();                                        var fileType = txt.substr(txt.indexOf(".") + 1);                        $(this).addClass(fileType);                    }                });            }        });    </script></body></html>
    Kind Regards
    Rob
    www.gnjgf.co.za
    www.oryan-projects.com
Working...
X