Jump to content

Multiple iFrames, pupulating arrays and writing buttons.


geudrik

Recommended Posts

I am in the process of writing a script that will take two values, add them to an array (the array can be of any size).  Then, a second function will take the values from the arrays and generate buttons based on a counter.  The mainContent iFrame will be where the population occurs, once all values have been submitted, a second function is run that will document.write into the menuFrame FROM the mainContent frame.

 

So far...

 

// Set cmdKey counter (so we know which order we load our values in...)
var cmdCtr        = 0;
// Define our array that will hold the various keycodes for the buttons
var cmdKeyCode    = new array;
// Define our array that will hold the keytexts
var cmdKeyText    = new array;


// To grab button ID's and Values on the fly from the JIT...
function addCmd(Text, keyCode)
{
cmdKeyCode[cmdCtr]  = keyCode;
cmdKeyText[cmdCtr]  = Text;
cmdCtr++;
}

// Function for creating an html string from arrays, 
// refresh button frame and then write buttons to frame.
// THIS FUNCTION IS EXECUTED FROM THE CONTENT FRAME - writes to buttonFrame
function writeCmd()
{
for(i; i < cmdCtr; i++)
{
	var value = cmdKeyText[i];
	var code  = cmdKeyCode[i];

	parent.buttonFrame.document.writeln("<input name='".code."' type='button' value='".value."' id='".code."' class='submenu_special' />");

}
}

 

I have a couple questions about my code here. 

a) Is this code going to do what I'm looking to do, and if not, why?

b) in php, you can add variables to a string being outputted by either using double quotes and just including the $var or by terminating the quotes, adding a period, then the var and continuing.  What's the equivilent to adding variables in JS to a document.writeln()

c) Are my frame references correct to writing the data into the second frame?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.