PDA

View Full Version : Window widget - open with a link?



jimEYE
07-07-2008, 08:41 PM
1) Script Title:
DHTML Window widget (v1.1)

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

3) Describe problem:
i would like to get the iframe content (example #1 on the demo.htm) to start out hidden and i have to open it with the link. Can you guys offer me any help on how to do that?

also, i would like to open more then 1 div content window (example #4 on the demo.htm). I made multiple div window links (each with their own content) and they only open 1 window and just overwrite each other into the 1 div window. Is there a way to open more then 1 window with div content in it?

thanks in advance for any help:)

ddadmin
07-07-2008, 11:00 PM
i would like to get the iframe content (example #1 on the demo.htm) to start out hidden and i have to open it with the link. Can you guys offer me any help on how to do that?

Are you saying the entire DHTML window hidden to start out, or just the IFRAME content area within it? For the later, you can try something like:


var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://www.google.com", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1")
googlewin.contentarea.style.visibility="hidden"

Then to show it again via clicking a link, call the code:


googlewin.contentarea.style.visibility="visible"


Is there a way to open more then 1 window with div content in it?

Of course. I suspect you're using the same variable name when calling dhtmlwindow.open(), causing one to overwrite the next. Make sure the variable names are unique:


var divwin=dhtmlwindow.open('divbox', 'div', 'som....)
var divwin2=dhtmlwindow.open('divbox', 'div', 'som....)

jimEYE
07-08-2008, 12:57 PM
thank you so much for the quick reply! Ive had bad experience with support forums that offer no help, makes for a crappy experience, lol

DIV QUESTION
unfortunately, i actually was not able to get any of your help to work, but i'm sure i was probably doing something dumb.


Of course. I suspect you're using the same variable name when calling dhtmlwindow.open(), causing one to overwrite the next. Make sure the variable names are unique:



var divwin=dhtmlwindow.open('divbox', 'div', 'som....)
var divwin2=dhtmlwindow.open('divbox', 'div', 'som....)


Yes, one was overwriting the next. Here's my example i was trying to do to get multiple windows from divs


<!-- DIV1 -->
<a href="#" onClick="divwin=dhtmlwindow.open('divbox', 'div', 'div1', 'Div 1 Title', 'width=220px,height=475px,left=200px,top=150px,resize=1,scrolling=1'); return false"><b>click here for div1</b></a>
<div id="div1" style="display:none">
div 1 text content
</div>


<!-- DIV2 -->
<a href="#" onClick="divwin2=dhtmlwindow.open('divbox', 'div', 'div2', 'Div 2 Title', 'width=600px,height=475px,left=200px,top=150px,resize=1,scrolling=1'); return false"><b>click here for div2</b></a>
<div id="div2" style="display:none">
hello all
</div>
and using that example they are still overwriting each other




IFRAME QUESTION

Are you saying the entire DHTML window hidden to start out, or just the IFRAME content area within it? For the later, you can try something like:
Yes, i wanted the DHTML window hidden, similar to how the div windows were hidden where i can display them using a link.

So far i have this for my code for the iframe link and it obviously is not working, lol

<!-- IFRAME TEST -->
<script type="text/javascript">
var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://www.google.com", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1")
googlewin.contentarea.style.visibility="hidden"
}
</script>
<a href="#" onClick="googlewin.contentarea.style.visibility="visible"(); return false">Show Window 1</a>

Here's my test site if you want to take a loko at it
http://awesomedotcom.org/GW.html

thanks again for the help

ddadmin
07-08-2008, 10:46 PM
Well, regarding the first overwrite problem, the first parameter when calling dhtmlwindow.open() also needs to be unique, since that represents the ID of the DHTML window container:


<!-- DIV1 -->
<a href="#" onClick="divwin=dhtmlwindow.open('divbox', 'div', 'div1', 'Div 1 Title', 'width=220px,height=475px,left=200px,top=150px,resize=1,scrolling=1'); return false"><b>click here for div1</b></a>
<div id="div1" style="display:none">
div 1 text content
</div>


<!-- DIV2 -->
<a href="#" onClick="divwin2=dhtmlwindow.open('divbox2', 'div', 'div2', 'Div 2 Title', 'width=600px,height=475px,left=200px,top=150px,resize=1,scrolling=1'); return false"><b>click here for div2</b></a>
<div id="div2" style="display:none">
hello all
</div>

This is explained on the script page actually.

Regarding hiding every DHTML window instance on the page so they are still loaded when the page loads, but hidden until a link is clicked on, inside the .js file, you first need to add to the 2 chunks of code below the new lines in red:


t.isScrolling(getValue("scrolling")) //Set whether window should contain scrollbars
t.style.visibility="hidden"

and


else
t.style.display="block"
t.style.visibility="visible"
this.setfocus(t)

Now you can call the show() function of each window instance as normal to show the window instance:


<li><a href="#" onClick="googlewin.show(); return false">Show Window 1</a></li>