DGRL
June 22, 2010, 7:02am
#1
Hi there,
I have a question about node manipulation.
First i load the tree using XML
In the xml file i have userdate assigned wich contains the link.
I want to open a link in a iframe in the same tab of my browser
Like version 1.6 you had a mainscreen with the tree and 1 iframe thats opened the link in that iframe.
Now i used this for my tree in version 2.5
<script>
tree.attachEvent("onClick",function(id){
window.open(tree.getUserData(id,"href"));
return true;
});
</script>
Now i know if i change window.open(tree.getUserData(id,“url”)); to
document.location.href=tree.getUserData(id,“url”); that it wil open the link in the same tab
What do i have to change or add so that the link wil open in a iframe
Thnx for your time.
If you want to know more please let me know
Greetings
HI,
possibly the following:
document.getElementById(iframe_id).src = tree.getUserData(id,“href”);
or
document.getElementById(iframe_id).window.contentDocument.location.href = url;
Where iframe_id is the id of the iframe.
DGRL
June 22, 2010, 7:13pm
#3
Hi Alexandra
I tried the 2 line’s and they don’t work
Maby i do some things wrong dont know
These 4 line i tried and only the 2 i allready had works fine but i don’t want that
I want the link to be opened in the Iframe.
window.open(tree.getUserData(id,“url”)); --> works opens a new tab or browser
document.location.href=tree.getUserData(id,“url”); --> works opens in the same tab
document.getElementById(test).src = tree.getUserData(id,“url”); --> doesn’t work
document.getElementById(test).window.contentDocument.location.href = url; --> doesn’t work
test is the name of the iframe i made
I use dhtmlxTree v.2.5 91111
This is my html file
<iframe id="test" name="test" width="100%" height="99%" frameborder="0" style="border: 2px solid #cecece;"></iframe>
This is a part of my xml file
<?xml version="1.0" encoding="iso-8859-1"?>
.\Branches\Landbouw\Page1.html
<item text="Level1" id="235" child="1">
<userdata name="url">alpha.html</userdata>
<item text="Level1a" id="235A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="235B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="235C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="235D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1b" id="236A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="236B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="236C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="236D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1c" id="237A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="237B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="237C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="237D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1d" id="238A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="238B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="238C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="238D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1e" id="239A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="239B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="239C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="239D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1f" id="240A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="240B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="240C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="240D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
<item text="Level1g" id="241A" child="1">
<userdata name="url">index.html</userdata>
<item text="Pagina 1" id="241B" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 2" id="241C" child="0">
<userdata name="url">objects.html</userdata>
</item>
<item text="Pagina 3" id="241D" child="0">
<userdata name="url">objects.html</userdata>
</item>
</item>
</item>
</item>
</tree>
Thanx for the time
Greetings
DGRL
Ps if you use this html and xml it wil not load the tree normal in IE8
i use firefox and its works fine in that browser
Hi,
try to enclose the iframe id in brackets. Probably that is the problem:
document.getElementById(“test”).src = tree.getUserData(id,“url”);
DGRL
June 23, 2010, 6:47pm
#5
Hi Alexandra,
Its works
thanx for your help
Greetings
DGRL