guowei1000
06-14-2004, 09:57 AM
Can someone tell me how to pass event/info/whatever from one frame to another?
function onclickthing(node)
{
document.writeln(node.nodeName NAME:NextFrame)
}
:confused: that dun seen to work....
Thanks :D
glenngv
06-14-2004, 10:37 AM
Can you provide enough information of your problem?
guowei1000
06-14-2004, 10:46 AM
sorry about that, i was doing the treetable using for loop. after i finish i realise i dunno how to pass the data from one frame(the treetable) to another frame(the frame beside it) . So the site will have two frames one beside another...
here my part of my treetable(when i onClick i call this function), abit messy....
function toogle_state(nodeCounter) // this toogle the state
{
var location = nodeCounter.sourceIndex // locate the location of the nodeCounter
var locationIMG = document.all[location + 1] //this locate the IMG tag for this
var nextDivLocation = document.all[location+2] // location the DIV
if (nextDivLocation.style.display =="")
{
nextDivLocation.style.display = "none"
locationIMG.src = "plus.gif";
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
}
}
heres my Index
<HTML>
<HEAD>
<title>Window explorer Copy cat</title>
<FORM NAME="Index">
</FORM>
<FRAMESET rows = "10%,*">
<FRAME SRC="treementtop.html" NAME="topthingy">
<FRAMESET cols = "*,80%" >
<FRAME SRC="finaltree.html" NAME="finaltree">
<FRAME SRC="sidethingy.html" NAME="sidethingy">
</frameset>
</frameset>
</head>
</HTML>
i still lack the skill to pass data/infor/whatever u all call it to another frame...
guowei1000
06-14-2004, 10:54 AM
sorry for the double post, forget to say that when i onclick i should pass the nodeCounter.data to the other frame... thanks for helping
glenngv
06-14-2004, 11:13 AM
Is the code you posted located in finaltree.html (finaltree frame)? And you want to pass the data to the sidethingy.html (sidethingy frame)?
parent.frames['sidethingy'].document.getElementById("theId").innerHTML=nodeCounter.data;
sidethingy.html should have a tag with id theId
<div id="theId"></div>
Hope this is what you want.
guowei1000
06-15-2004, 04:58 AM
the code doesnt work.... even after i change the getElement's'ById ... it said "Object doesnt support this property or method"
:confused:
guowei1000
06-15-2004, 05:57 AM
I had added the <div id="theid"></Div> into the sidethingy.html
<html>
<head>
<script language ="JAVASCRIPT">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("note.xml");
var strContent =""
var transfernode =""
function TestChildren(nodes) // write the first layer out
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
document.writeln("<A onClick='javaScript:toogle_state(this)'><font color= red><IMG SRC='minus.gif'>"+ nodes.nodeName +"</font></A>");
if (nodes.hasChildNodes)
{
document.writeln("<DIV>")
for (var i=0; i < nodes.childNodes.length; i++) // write second layer out then pass the third layer to the writechildren() funtion
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (nodes.childNodes(i).hasChildNodes) // add toogle in
{
document.writeln("<font color= red><A onClick='javaScript:toogle_state(this)'><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
else
{
document.writeln(nodes.childNodes(i).nodeName);
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
document.writeln("</DIV>")
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
function toogle_state(nodeCounter) // this toogle the state and pass info to the sideView.html side
{
var location = nodeCounter.sourceIndex // locate the location of the nodeCounter
var locationIMG = document.all[location + 1] //this locate the IMG tag for this
var nextDivLocation = document.all[location+2] // location the DIV
if (nextDivLocation.style.display =="")
{
nextDivLocation.style.display = "none"
locationIMG.src = "plus.gif";
parent.frames['sidethingy'].document.getElementsById("theId").innerHTML=nextDivLocation.innerText;
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
}
}
function writechildren(sianz)
{
if (sianz.hasChildNodes)
{
document.writeln("<DIV>")
for (var i=0; i < sianz.childNodes.length; i++) // check the length of the childNOdes
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (sianz.childNodes(i).hasChildNodes) // add toogle in
{
if (sianz.childNodes(i).nodeName == "#text")
{
document.writeln("<font color= red><A onClick='javaScript:toogle_state(this)'><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i)) // if this layer got children then pass up so this layer of children can be written
}
else
{
document.writeln("<font color= red><A onClick='javaScript:toogle_state(this)'><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}
}
else
{
if (sianz.childNodes(i).nodeName == "#text") // no children come here
{
document.writeln(sianz.childNodes(i).text);
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).nodeName);
writechildren(sianz.childNodes(i))
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
document.writeln("</DIV>")
}
}
function callReadXml()
{
root = xmlDoc.documentElement;
TestChildren(root);
}
</script>
</head>
<body>
<script type="text/javascript">
callReadXml();
</script>
</body>
</html>
glenngv
06-15-2004, 06:08 AM
parent.frames['sidethingy'].document.getElementsById("theId").innerHTML=nextDivLocation.innerText;
I didn't put an s in document.getElementById.
guowei1000
06-15-2004, 06:11 AM
hey! it work! must be working with getElementsByName too much :P thanks!! :D:D:D
guowei1000
06-15-2004, 09:21 AM
Now i'm able to pass the data to the other frame.... can i control it? like how it display?how do i pass the data to a valuable? i cant see to find the tutorial for this.. then very ambarrassing to keep asking....
glenngv
06-15-2004, 09:59 AM
<div id="theid" style="font:normal 12px Verdana;color:blue;"></div>
or
<head>
<style type="text/css">
div#theid {
font:normal 12px Verdana;
color:blue;
}
</style>
</head>
...
<div id="theid"></div>
Is that what you were asking for?
guowei1000
06-15-2004, 10:26 AM
arh can u explain the code? try to search for help but nothing come up...
glenngv
06-15-2004, 10:41 AM
Learn CSS here (http://www.w3schools.com/css/default.asp).
guowei1000
06-15-2004, 10:45 AM
thanks ! finally find something i can use :D
schuby
01-09-2007, 02:14 AM
Hi, I have a similar problem I was hoping I could get help with.
I have a photo gallery website. I have a frame on the left side with all the thumbnails and I want the images onMouseOver to appear in a div on the Right frame which is the main page. I have all of the java script for the mouseover in the left/thumbnail frame as well as the div thats holds the appearing images. I want to move the div over to the right frame.
I would greatly appreciate anyones sudgestion to this problem
Thanks... Schuby