Results 1 to 4 of 4

Thread: Window widget - open with a link?

  1. #1
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Window widget - open with a link?

    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

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    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:

    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:

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

  3. #3
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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:

    Code:
    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

    Code:
    <!-- 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
    Code:
    <!-- 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

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:
    Code:
    <!-- 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:

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

    Code:
    	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:

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •