rondog Posted August 27, 2008 Share Posted August 27, 2008 I have a popup at the end of a quiz. It works fine in IE, but I get a debug error in IE7 and it points to this line in my js: Also, the error is 'Invalid Argument'. <?php var surveyTaken; var newWindow; function window_onunload() { if(SCORM.connection.isActive){ if(SCORM.data.get("cmi.core.lesson_status") == "passed" || SCORM.data.get("cmi.core.lesson_status") == "completed" ) { //launch the survey if its false if(surveyTaken == false) { newWindow = window.open("survey.htm","Course Evaluation"); //This line! if(window.focus) { newWindow.focus(); }; } } SCORM.connection.terminate(); } } ?> Any idea whats going on? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted August 27, 2008 Share Posted August 27, 2008 I'm guessing you're missing a parameter in your window.open() method. Quote Link to comment Share on other sites More sharing options...
rondog Posted August 27, 2008 Author Share Posted August 27, 2008 ok you were right, the window title was throwing it off. I have another question now... The man wants me to use this code since were using an iframe: <?php if(typeof parent != "undefined") { parent.document.location.href = "survey.htm"; } else { document.location.href = "survery.htm"; } ?> That isnt working at the moment and I am not familiar with iframes Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted August 27, 2008 Share Posted August 27, 2008 Uh, first of all, that's NOT php code. Remove the PHP tags. Also, you should give the iframe a name attribute. Something like: <iframe name='theframe' id='theframe'></iframe> Then use this JavaScript code: var tehFrame = null; if (document.all) tehFrame = frames['theframe']; else tehFrame = document.getElementById("theframe"); if (tehFrame !== null) tehFrame.src = "survey.htm"; else window.location.href = "survey.htm"; Quote Link to comment Share on other sites More sharing options...
rondog Posted August 27, 2008 Author Share Posted August 27, 2008 I know its not PHP, but using the PHP tags, you get somewhat accurate color tagging and its easier to read then the code tags. Ok so I tried your method and still no luck. Here is my whole function: <?php function window_onunload() { if(SCORM.connection.isActive){ if(SCORM.data.get("cmi.core.lesson_status") == "passed" || SCORM.data.get("cmi.core.lesson_status") == "completed" ) { var theFrame = null; if(document.all) { theFrame = frames['lmscontentFrame']; } else { theFrame = document.getElementById("lmscontentFrame"); } if(theFrame !== null) { theFrame.src = "survey.htm"; } else { window.location.href = "survey.htm"; } } SCORM.connection.terminate(); } } ?> It is in an onunload function so I think this defeats the iframe thing anyway. I just need to popopen a survey when the user closes the course window. The way I was doing it before was working, but they suggest I do it this way...I have no idea why... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted August 27, 2008 Share Posted August 27, 2008 Can you put your entire code. I don't know what the variables SCORM is or SCORN.connection, etc. And please include your HTML. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.