Destiny Amana
asked on
Javascript Error in Onclose Handler
I got this script of Dynamic Drive and have been trying to customise the script.
This is the original
<script type="text/javascript">
var agreewin=dhtmlmodal.open(" agreebox", "iframe", "surveyinfo.asp", "UBA Survey", "width=590px,height=250px, center=1,r esize=1,sc rolling=0" , "recal")
agreewin.onclose=function( ){ //Define custom code to run when window is closed
var theform=this.contentDoc.ge tElementBy Id("eula") //Access form with id="eula" inside iframe
var yesbox=theform.eulabox[0] //Access the first radio button within form
var nobox=theform.eulabox[1] //Access the second radio button within form
if (yesbox.checked==true)
alert("You are now being redirected to our online survey\nThank you for taking time out to do this survey")
else if (nobox.checked==true)
//alert("You didn't agree to the terms")
return true //Allow closing of window in both cases
}
</script>
And this is the line that I have added "window.location.href="./p olls/defau lt.asp""
I want this to riderect and open a new windows but the script generates an error message before redirecting and it redirects to the parent window.
<script type="text/javascript">
var agreewin=dhtmlmodal.open(" agreebox", "iframe", "surveyinfo.asp", "UBA Survey", "width=590px,height=250px, center=1,r esize=1,sc rolling=0" , "recal")
agreewin.onclose=function( ){ //Define custom code to run when window is closed
var theform=this.contentDoc.ge tElementBy Id("eula") //Access form with id="eula" inside iframe
var yesbox=theform.eulabox[0] //Access the first radio button within form
var nobox=theform.eulabox[1] //Access the second radio button within form
if (yesbox.checked==true)
alert("You are now being redirected to our online survey\nThank you for taking time out to do this survey")
else if (nobox.checked==true)
//alert("You didn't agree to the terms")
return true //Allow closing of window in both cases
window.location.href="./po lls/defaul t.asp"
}
</script>
Could someone help me out here ?
This is the original
<script type="text/javascript">
var agreewin=dhtmlmodal.open("
agreewin.onclose=function(
var theform=this.contentDoc.ge
var yesbox=theform.eulabox[0] //Access the first radio button within form
var nobox=theform.eulabox[1] //Access the second radio button within form
if (yesbox.checked==true)
alert("You are now being redirected to our online survey\nThank you for taking time out to do this survey")
else if (nobox.checked==true)
//alert("You didn't agree to the terms")
return true //Allow closing of window in both cases
}
</script>
And this is the line that I have added "window.location.href="./p
I want this to riderect and open a new windows but the script generates an error message before redirecting and it redirects to the parent window.
<script type="text/javascript">
var agreewin=dhtmlmodal.open("
agreewin.onclose=function(
var theform=this.contentDoc.ge
var yesbox=theform.eulabox[0] //Access the first radio button within form
var nobox=theform.eulabox[1] //Access the second radio button within form
if (yesbox.checked==true)
alert("You are now being redirected to our online survey\nThank you for taking time out to do this survey")
else if (nobox.checked==true)
//alert("You didn't agree to the terms")
return true //Allow closing of window in both cases
window.location.href="./po
}
</script>
Could someone help me out here ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes... u can do that..
ASKER