PDA

View Full Version : DHTML Modal window Resize?



SteveToms
01-05-2008, 05:08 AM
1) Script Title: DHTML Modal window v1.01

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm

3) Describe problem: Is there a way to have the window auto resize to a new size when a link is link on in the window??

http://stevetoms.com/dhtmlwindow/ftgairlines2.htm

For example, on Air France-KLM, when I click the F icon, can the window become smaller??

ddadmin
01-05-2008, 07:21 AM
You should be able to do this by calling the setSize(w, h) method. For a list of methods available, see: http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

SteveToms
01-05-2008, 07:32 AM
So do I put the code on the page where all my logos are, or the windowed page?

SteveToms
01-05-2008, 11:02 PM
I want to make sure people know what I am asking, I know I can have a resize on the main page, but how do I make it work on the DHTML Modal Window that opens?

ddadmin
01-07-2008, 10:26 AM
If you wish to resize the DHTML window from within the page contained within this window, you can do so by referring back to the main page first, then calling setSize(w, h). For example, lets say on your main page, you've opened up a DHTML modal window:


<script type="text/javascript">
var mysurvey=dhtmlmodal.open("surveybox", "iframe", "survey.htm", "Fill out this survey", "width=700px,height=450px,resize=1,scrolling=1,center=1", "recal")
</script>

Then inside survey.htm, you wish to create a link that resizes the window it's contained in. You would do something like:


<a href="#" onClick="parent.mysurvey.setSize(500, 400); return false">Resize Me</a>

In other words, the key is to call "parent" in front of the method you wish to run, when that method is being called from the DHTML window itself.

SteveToms
01-07-2008, 11:30 AM
Still a tad confused. First is there a way I can not have it auto open? Second, how do I make it work for click to open?

ddadmin
01-07-2008, 12:51 PM
A DHTML modal window can be set to open when you click on a link, for example. This is actually already demonstrated in demo #2 and #3 on the script page (http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm). The code would look something like:


<script type="text/javascript">

function opennewsletter(){
//Open a modal window with an iframe page inside, and assign the result to a global variable called "emailwindow"
emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'modalfiles/newsletter.htm', 'Newsletter Signup page', 'width=350px,height=200px,center=1,resize=0,scrolling=1')

</script>

<a href="#" onClick="opennewsletter(); return false">Signup for our newletter:</a> <span id="youremail" style="color: red"></span>

SteveToms
01-07-2008, 01:06 PM
I got it now thanks

SteveToms
01-07-2008, 01:31 PM
I know can't seem to get the link to change links, bascially the page reloads the old page

ddadmin
01-07-2008, 11:05 PM
I know can't seem to get the link to change links, bascially the page reloads the old page

Do you have an example of this I can see on your page?

SteveToms
01-07-2008, 11:20 PM
http://stevetoms.com/dhtmlwindow/ftgairlines2.htm

See it resizes but does not open my link I have set.

SteveToms
01-07-2008, 11:35 PM
Nope, I can't get it to resize. But goto the link

ddadmin
01-08-2008, 11:55 AM
Inside the page "afrklm.htm", I see you have something like:


onClick="parent.AFRKLMwindow.setSize('../modalfiles/afrklmcargo.htm',465, 580); return false"

This is incorrect. As mentioned in my earlier post, the syntax should be "parent.windowinstancename...", so something like:


onClick="parent.emailwindow.setSize('../modalfiles/afrklmcargo.htm',465, 580); return false"

based on what you have on your main page.

SteveToms
01-09-2008, 03:23 AM
I can't get it too resize and change links at same time. No matter how i have the code

SteveToms
01-09-2008, 06:45 AM
I edited out return false, and for some reason it works for both size and link to page i want, at same time....