Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Passing values between frames


Message #1 by "arun" <arun@l...> on Wed, 6 Feb 2002 11:13:44 +0530
Hi

Actually you can read/write variables across frames:

Scenarie:

Frame 1 (name =3D "frame1") contains an array with some values in:
     Javascript:
     val filenames =3D new Array('autoexec.bat', 'system.ini');

     HTML:
     <a href=3D"javascript:void(top.frames
['frame1'].displayFilenames[top.frames['frame1'].filenames];)">Display
filenames</a>

Frame 2 (name =3D "frame2") wants to display these with checkboxes on:

     JAVASCRIPT:
     function displayFilenames(arrayElement) {
        display =3D ''
        for(var i =3D 0; i<arrayElement; i++) {
          display+=3D'<input type=3D"checkbox" value=3D"'+arrayElement[
i]+'" name
=3D"file'+i+'"> "+arrayElement[i]+'<br>';
       }
       filelist.innerHTML =3D display;
     }

     HTML:
     <div id=3D"filelist"></div>

Hope this will give you some ideas!

The essence is - I guess - that you can address between frames in
Javascript!


Cheers

Sten Hougaard
EDB Gruppen
Application developer/web-designer




                                                                       
                                           
                    "arun"                                             
                                           
                    <arun@l...       To:     "JavaScript HowTo" <ja
vascript_howto@p...>               
                    ia.net>              cc:                           
                                           
                                         Subject:     [javascript_howto
] Passing values between frames            
                    02/06/2002                                         
                                           
                    06:43 AM                                           
                                           
                    Please respond                                     
                                           
                    to "JavaScript                                     
                                           
                    HowTo"                                             
                                           
                                                                       
                                           
                                                                       
                                           






Hi,

Can we use javascript/vbscript to pass variable values between  two fra
mes?

Requirement:
In frame1 is am displaying list of filenames as  link
In frame2 i have the next and back button.
In frame 3 i am displaying the files

when i click the filename in frame1, i want the index of the  filename 
in
frame2. Is that possible?

regards
arun

$subst('Email.Unsub').





  Return to Index