guowei1000
06-16-2004, 09:01 AM
This is the code i use to pass nextDivLocation.innerText to the sidethingy frames... but i cant control in the text... control as in store in a variable then do something with it.... can help?
parent.frames['sidethingy'].document.getElementById
("theId").innerHTML=nextDivLocation.innerText;
glenngv
06-16-2004, 10:11 AM
like this?
var str = nextDivLocation.innerText;
//do what you want to str
Please describe your problem in more detail.
guowei1000
06-16-2004, 10:18 AM
i passed some text from one frame to another so it something like
parent.frames['sidethingy'].document.getElementById
("theId").innerHTML=nextDivLocation.innerText;
so the text now appear on the other frame.... but i wan to do something with it like loop or whatever so how do i store the text into a valuabe so i can do something with it?
glenngv
06-16-2004, 10:51 AM
That's what I did in my post above. I store the innerText to a variable.
guowei1000
06-16-2004, 10:56 AM
got a undefined msg.....
<head>
<script>
var str = nextDivLocation.innerText;
alert(str)
</script>
</head>
so when onClick i pass the text from the tree frame(left hand side ) to the right hand side frame(sidethingy) then the str store the nextDivLocation.innerText;??
glenngv
06-16-2004, 11:11 AM
Where is that script located, in the sidethingy frame or in the frame where you did:
parent.frames['sidethingy'].document.getElementById
("theId").innerHTML=nextDivLocation.innerText;
?
Are you sure the nextDivLocation object is already loaded and initialized when you store its content in the str variable?
guowei1000
06-17-2004, 02:31 AM
there are three script
<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>
this is where i do those frame thingy stuff.
This is my side frame, right hand side script
<html>
<head>
<div id="theId"></div>
<div id="divTarget" ondragenter="cancelEvent()" ondragover="cancelEvent()" ondrop="drop(this)">Drop on me</div>
<style>
#divTarget {position: absolute; left: 300px; width: 100px; height: 100px; background-color: red; font-weight: bold}
</style>
<script>
function cancelEvent() {
window.event.returnValue = false;
}
function drop(counterThis) {
alert(counterThis.nodeName);
}
</script>
</head>
<body>
</body>
</html>
this is my left hand frame script
<html>
<head>
<script type="text/javascript" src="buildtree.js"></script>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("note.xml");
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";
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
parent.frames['sidethingy'].document.getElementById("theId").innerHTML=nextDivLocation.innerText;
}
}
function callReadXml()
{
root = xmlDoc.documentElement;
TestChildren(root);
}
</script>
</head>
<body>
<script type="text/javascript">
callReadXml();
</script>
</body>
</html>
glenngv
06-17-2004, 03:47 AM
So where is this code?
var str = nextDivLocation.innerText;
I didn't see it in the 3 scripts you posted.
guowei1000
06-17-2004, 03:49 AM
cause it din work so i take it out :P forget to put it in when i post
This is my side frame, right hand side script
<html>
<head>
<div id="theId"></div>
<div id="divTarget" ondragenter="cancelEvent()" ondragover="cancelEvent()" ondrop="drop(this)">Drop on me</div>
<style>
#divTarget {position: absolute; left: 300px; width: 100px; height: 100px; background-color: red; font-weight: bold}
</style>
<script>
var str = nextDivLocation.innerText;
function cancelEvent() {
window.event.returnValue = false;
}
function drop(counterThis) {
alert(counterThis.nodeName);
}
</script>
</head>
<body>
</body>
</html>
glenngv
06-17-2004, 05:49 AM
Change this:
var str = nextDivLocation.innerText;
to this:
function controlText(str){
alert(str);
//do something with str
}
And also this:
parent.frames['sidethingy'].document.getElementById("theId").innerHTML=nextDivLocation.innerText;
to this:
var stFrame = parent.frames['sidethingy'];
stFrame.document.getElementById("theId").innerHTML=nextDivLocation.innerText;
stFrame.controlText(nextDivLocation.innerText);
guowei1000
06-17-2004, 06:25 AM
it work! thanks!
/me bow to ur greatness! :D