Click to See Complete Forum and Search --> : How to target a frame using JavaScript Tree???


scorpiobytes
02-10-2006, 03:43 AM
Hi all,

I am a newbee in HTML & JavaScripting. I am developing a intranet site. The home page contains two frames, one on the left of the screen with 20% display area and the other with 80% display area. I have implemented a Javascript tree structure on the 1st frame (20%) and want to display it on the 2nd frame (80%). The code I have is as follows:

<html>
<head>
<title>Tech-Tree</title>
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
</head>

<body>
<BODY BACKGROUND="MehendiGreenBG.gif">

<h4>Site Under Construction</h4>

<div class="dtree">

<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>

<script type="text/javascript">
<!--

d = new dTree('d');

d.add(0,-1,'Decision Tech-Tree');
d.add(1,0,'Ready Reckoner','Ready Reckoner.htm');
d.add(2,0,'Telephone Directory','Telephone Index.htm','','','img/imgfolder.gif');
d.add(3,1,'Node 1.1','example.htm');
d.add(4,0,'Email & URL addresses','example.htm');
d.add(5,3,'Node 1.1.1','example.htm');
d.add(6,5,'Node 1.1.1.1','example.htm');
d.add(7,0,'Node 4','example.htm');
d.add(8,1,'Node 1.2','example.htm');
d.add(9,0,'THD','example.htm','Pictures I\'ve taken over the years','','','img/imgfolder.gif');
d.add(10,9,'The trip to Coorg','example.htm','Pictures of Gullfoss and Geysir');
d.add(11,9,'Mom\'s birthday','example.htm');
d.add(12,0,'SeP Bulletin','example.htm','','','img/trash.gif');

document.write(d);


//-->
</script>

</div>

// The script below works and displays on the 2nd frame//
<a href="Ready Reckoner.htm" target="content">Target Test Link</a>

</body>

</html>

The class file is dtree.js and dtree.css is attached. Please help me with this.....

Thanks in advance...

scorpiobytes

Note: Some syntax and example codes will be appreciated to enhance the code.

rits
09-14-2006, 01:21 AM
HI there, I am facing the same issue as below, can you please let me know if you resolved this issue, and how? maybe a code sample?

Thank you

emilmont
10-24-2006, 01:57 PM
A solution can be to set a default target for links:

@see
16 Frames
16.3.1 Setting the default target for links
http://www.w3.org/TR/html401/present/frames.html#h-16.3.1

@example
[index.html]
<html>
<head><title>Test</title></head>
<frameset cols="15%, 85%">
<frame name="toc" src="toc.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="1">
<frame name="content" src="page01.html" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
</frameset>

[toc.html]
<html>
<head>
<link rel="StyleSheet" href="dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
<BASE href="" target="content">
</head>
<body>
<script type="text/javascript">
d = new dTree('d');

d.add(0,-1,'Menu');
d.add(1,0,'Node 1','page01.html');
d.add(2,0,'Node 2','page02.html');

document.write(d);
</script>
</body>
</html>

willin13
10-20-2008, 12:12 PM
you can also specify a target as the 6th paramater in the d.add function call. For example:

d.add(1,0,'Node 1','node1.html', null, 'contents');