Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Apr 20, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Dynamically Loading Different Files Into Frames

Using the frame's location object, you can load a number of different files into a frame at runtime. As you do when building any project using frames, first build a file that defines your frame. For our example, we defined a frame called myframe. The code below would then go in a separate file.

Placed in the BODY of the code is a list of files from which the user can choose. When a user clicks on the file name he wants to load, the name of the file is passed as a parameter to the function. The function appends the ".htm" extension to the name, and assigns the complete name to the location object of the frame myframe, which loads the appropriate file into that frame.
<TITLE> History topics </TITLE>
function loadfile(whatfile) {
parent.myframe.location = whatfile + ".htm";
<DIV onclick = "loadfile('file1')" > Load file 1</DIV>
<DIV onclick = "loadfile('file2')" > Load file 2</DIV>
<DIV onclick = "loadfile('file3')" > Load file 3</DIV>
Manoj K.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date