PDA

View Full Version : DHTML Modal Window(Terms and Codition onload)



mahyang
08-05-2008, 01:40 AM
I'm a newbie in javascript...

I'm using DHTML Modal Window, and it's really work but when i click the submit button in my registration form
the modal window will appear or onload in my registration form...
even though the DHTML modal window is loaded before the registration form is active..?
this is my code below::::

<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript" src="windowfiles/dhtmlwindow.js">

/***********************************************
* DHTML Window Widget- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<link rel="stylesheet" href="modalfiles/modal.css" type="text/css" />
<script type="text/javascript" src="modalfiles/modal.js"></script>

<script type="text/javascript">

var agreewin=dhtmlmodal.open("agreebox", "iframe", "modalfiles/agreement.htm", "This Page's Terms of service", "width=590px,height=450px,center=1,resize=1,scrolling=0")

agreewin.onclose=function(){ //Define custom code to run when window is closed
var theform=this.contentDoc.getElementById("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 agreed to the terms")
else if (nobox.checked==true)
alert("You didn't agree to the terms")


//document.getElementById("youremail").innerHTML=yesbox.value

return true //Allow closing of window in both cases
}



</script>

<form action="reg_prog" method="post">

Name: <input type="text" name="FirstName">

<input type="submit" name="reg" value="Register">
</form>


any suggestion guys....tnxz....

ddadmin
08-05-2008, 05:14 AM
Warning: Please include a link to the DD script in question in your post, in this case: http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

The DHTML Modal window will reposition/ reappear when the page has fully loaded if you have the "recal" last parameter set. This seems to be describing your issue, though in the code you posted above, I don't see it defined:


var agreewin=dhtmlmodal.open("agreebox", "iframe", "modalfiles/agreement.htm", "This Page's Terms of service", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")

Please post a link to the page on your site that contains the problematic script so we can check it out.