Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to control a variable that is being passed to another frame?

    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;

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    like this?

    var str = nextDivLocation.innerText;
    //do what you want to str

    Please describe your problem in more detail.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    That's what I did in my post above. I store the innerText to a variable.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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;??

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    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?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #7
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    So where is this code?

    var str = nextDivLocation.innerText;

    I didn't see it in the 3 scripts you posted.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #10
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Change this:

    var str = nextDivLocation.innerText;

    to this:
    Code:
    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);
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #11
    New Coder
    Join Date
    May 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it work! thanks!

    /me bow to ur greatness!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •