Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    68
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How do I open a link from this ajax tree into a specific frame~?

    Code:
    oaktree.addItem("RC Mail", branch1, "rcmail/") //Add this item to branch2
    I can open it up in the current page, but the menu is in a frame and I need to open it in a fram called "home".

    How can I do that~??

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    You just need to add a target attribute to the link (e.g. target="home").

    But I don't know how the ajax tree generates the link. You need to post the related code of the ajax tree script or post a link to it.

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    68
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Code:
    <script type="text/javascript">
    
    var oaktree=new jktreeview("tree2")
    oaktree.addItem("Laments", "", "crazy430r.com")
    
                   var branch1=oaktree.addItem("Utilities", "") //A TREE BRANCH
    oaktree.addItem("RC Mail", branch1, "rcmail/") //Add this item to branch2
    
    
    </script>
    where do I put the "target" attribute at~? I can do it in html but in javascript, it doesnt work.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Can't tell with just those code. You need to post the script for the jktreeview. Where did you get this script? There must be some demo posted online. If you could post a link to it or post the code here, that would be helpful.

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    68
    Thanks
    1
    Thanked 0 Times in 0 Posts
    okay check here (it might change cuz im playing around with ti)

    http://www.mujak.com/test/demo.php

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    In the jktreeview.js, change this
    Code:
    jktreeview.prototype.addItem=function(itemText, noderef, href){
    	var noderef=(typeof noderef!="undefined" && noderef!="")? noderef : this.treetop.getRoot()
    	var treebranch=new YAHOO.widget.TextNode(itemText, noderef, false)
    	if (typeof href!="undefined")
    		treebranch.href=href
    	return treebranch
    }
    to:

    Code:
    jktreeview.prototype.addItem=function(itemText, noderef, href, target){
    	var noderef=(typeof noderef!="undefined" && noderef!="")? noderef : this.treetop.getRoot()
    	var treebranch=new YAHOO.widget.TextNode(itemText, noderef, false)
    	if (typeof href!="undefined")
    		treebranch.href=href
    	if (typeof target!="undefined")
    		treebranch.target=target
    	return treebranch
    }
    Then in your code
    Code:
    oaktree.addItem("Laments", "", "crazy430r.com", "home");
    Note: This is just an educated guess. I assume that the Yahoo widget TextNode returns a hyperlink object. I didn't have the time to dig through the YUI code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •