...

View Full Version : How do I open a link from this ajax tree into a specific frame~?



bruceleejr
11-16-2010, 07:50 PM
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~??

glenngv
11-16-2010, 08:23 PM
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.

bruceleejr
11-16-2010, 08:26 PM
<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.

glenngv
11-16-2010, 10:05 PM
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.

bruceleejr
11-16-2010, 10:47 PM
okay check here (it might change cuz im playing around with ti)

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

glenngv
11-16-2010, 11:00 PM
In the jktreeview.js, change this

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:


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

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum