Crazy iFrames/JavaScript Problem

I have a Storyline variable, and based on the variable's value I need to open one of a set of web pages within Storyline. (Value A goes to Page A,Value B opens Page B, etc.)

Since the variable determines the URL I can't use the Web Object, so I had to use JavaScript.  Now my novice-level coding skills are showing!  As you can see from the image below, the iFrame I made appears in the parent window and behind the Storyline player.  

iFrame in parent window

Here is the code I'm using:

var player = GetPlayer();
var myGrade = player.GetVar("myGrade");
var myURL = "http://www.gsjia.org/z_points_" + myGrade;
console.log (myURL);
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", myURL);
ifrm.style.width = 550+"px";
ifrm.style.height = 333+"px";
document.body.appendChild(ifrm);

Can anyone suggest a fix?

Thanks,
Sharon

 

1 Reply