After seeing several examples of how to pass variables through to an iframe page, and after talking to various people at various coding sites, I STILL can't adopt their techniques to do it with my variables.
So I think I need to be more clear:
- My site is for playtesting a boardgame
- There are 6 forms, 1 for each player
- Each form has dropdown boxes and checkboxes
- I have other forms on the page too, to deal with other things, but lets just focus on the player forms
- when you click on a gameboard square, a page loads in an iframe. This page NEEDS to show variables from the player forms such as who owns the property, how many upgrades (checkboxes) are checked (think monopoly), etc..
Everything in my script is now working except that I cannot pass these variables through.
Someone said to do this:
if (window.parent.document.africa.south_africa_1.selectedIndex == 0)
south_africa_owner = "--";
else if (window.parent.document.africa.south_africa_1.selectedIndex == 1)
south_africa_owner = "1";
else if (window.parent.document.africa.south_africa_1.selectedIndex == 2)
south_africa_owner = "2";
else if (window.parent.document.africa.south_africa_1.selectedIndex == 3)
south_africa_owner = "3";
else if (window.parent.document.africa.south_africa_1.selectedIndex == 4)
south_africa_owner = "4";
else if (window.parent.document.africa.south_africa_1.selectedIndex == 5)
south_africa_owner = "5";
south_africa_owner = "6";
if (window.parent.document.africa.south_africa_2.checked == true)
south_africa_mortgage = "MORTGAGED!";
south_africa_mortgage = "";
if (window.parent.document.africa.south_africa_3.checked == true)
upgrade_1_1 = 1;
upgrade_1_1 = 0;
if (window.parent.document.africa.south_africa_4.checked == true)
upgrade_1_2 = 1;
upgrade_1_2 = 0;
if (window.parent.document.africa.south_africa_5.checked == true)
upgrade_1_3 = 1;
upgrade_1_3 = 0;
if (window.parent.document.africa.south_africa_6.checked == true)
upgrade_1_4 = 1;
upgrade_1_4 = 0;
if (window.parent.document.africa.south_africa_7.checked == true)
upgrade_1_5 = 1;
upgrade_1_5 = 0;
south_africa_upgrades = (upgrade_1_1 + upgrade_1_2 + upgrade_1_3 + upgrade_1_4 + upgrade_1_5)
I WISH it was as easy as putting window.parent in front of .document..., but that doesn't work.
I'm not a professional coder, this isn't for money. It is an OFFLINE website used to playtest my boardgame. I've been working on it for years, and it is imperitive to me that I figure out how to pass these variables.
Could someone PLEASE show me a clear example, and then help me out with anything in that example I don't understand?