Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How do I make the window widget pop up in a drop down list?

  1. #1
    Join Date
    Jul 2007
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default How do I make the window widget pop up in a drop down list?

    1) Script Title: window widget

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:
    I want to make the window widget pop up from a drop down list

    I have a basic drop down menu:

    PHP Code:
    <select name="menu">
    <
    option value="#">blah</option>
    <
    option value="#">blah</option>
    <
    option value="http://example.htm">blah</option>
    </
    select>
    <
    a href="javascript:jumpMenu()"><IMG SRC="http://img36.picoodle.com/img/img36/8/6/29/f_heartm_abbd3e9.png" border=0></a>
    </
    form></td
    and i want to make the window widget pop up from it, let's say:

    PHP Code:
    <a href="#" onClick="examplewin=dhtmlwindow.open('ASDF!', 'iframe', 'example.com', 'ASDF', 'width=1337px,height=666px,center=1'); return false">ASDF!</a
    So how would I?

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

    Default

    Do you mean use a drop down menu to launch a DHTML window based on the value of the selected option? Something like this would work:

    Code:
    <script type="text/javascript">
    
    function loadwindow(selectedoption){
    iframewin=dhtmlwindow.open("examplebox", "iframe", selectedoption.value, selectedoption.text, "width=590px,height=350px,resize=0,scrolling=1,center=1")
    }
    
    </script>
    
    <select onChange="loadwindow(this.options[this.selectedIndex])">
    <option value="http://google.com">Example</option> 
    <option value="http://yahoo.com">Example 2</option> 
    <option value="http://digg.com">Example 3</option>
    </select>

  3. #3
    Join Date
    Jul 2007
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    I mean, what about the button? I tried the code, but don't I have to change the code for the button?
    Last edited by tivaelydoc; 07-03-2007 at 07:27 AM. Reason: I'm am stupid

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

    Default

    Do you mean a form button that's associated with the select menu, so that clicking on it would also load the DHTML window based on the selected option value?

  5. #5
    Join Date
    Jul 2007
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Yes sort of. Currantly, my button is
    PHP Code:
    <a href="Javascript:jumpMenu()"><IMG SRC="http://example.jpg" border=0></a
    I don't want the window to pop up when the option is select, but instead when the button is clicked after it is selected.

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

    Default

    Sure. Instead of the code I posted above, try the following instead:

    Code:
    <script type="text/javascript">
    
    function loadwindow(selectid){
    var selectelement=document.getElementById(selectid)
    var selectedoption=selectelement.options[selectelement.selectedIndex]
    iframewin=dhtmlwindow.open("examplebox", "iframe", selectedoption.value, selectedoption.text, "width=590px,height=350px,resize=0,scrolling=1,center=1")
    }
    
    </script>
    
    <form>
    <select id="winlist">
    <option value="http://google.com">Example</option> 
    <option value="http://yahoo.com">Example 2</option> 
    <option value="http://digg.com">Example 3</option>
    </select> <a href="#" onClick="loadwindow('winlist')">Load Selected Window</a>
    </form>

  7. #7
    Join Date
    Jul 2007
    Posts
    40
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot man. It worked.

  8. #8
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Hi to all, i'am new user on this forum...

    i use this script posted by ddadmin and work fine:

    <script type="text/javascript">

    function loadwindow(selectid){
    var selectelement=document.getElementById(selectid)
    var selectedoption=selectelement.options[selectelement.selectedIndex]
    iframewin=dhtmlwindow.open("examplebox", "iframe", selectedoption.value, selectedoption.text, "width=590px,height=350px,resize=0,scrolling=1,center=1")
    }

    </script>

    <form>
    <select id="winlist">
    <option value="http://google.com">Example</option>
    <option value="http://yahoo.com">Example 2</option>
    <option value="http://digg.com">Example 3</option>
    </select> <a href="#" onClick="loadwindow('winlist')">Load Selected Window</a>
    </form>


    but i have 2 questions:

    1 - How i can cancel this script for one especific option? example:

    <select id="winlist">
    <option value="OPEN ONE PAGE WHEN CLICK HERE">Example</option>
    <option value="OPEN ONE PAGE WHEN CLICK HERE">Example 2</option>
    <option value="NOT OPEN ANY PAGE WHEN CLICK HERE">Example 3</option>
    </select>

    2 - Other question is:

    When i open a window using this script what i need make to if the page have a link if i click not open the link in the same window but in master window (used to open a popup)

    Sorry for my bad english, if yours not understand i can try explain again...

    Thank youuuu

  9. #9
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Please, someone help me, is what I asked is possible or is not done using this script?

    ddadmin Can you help me?

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

    Default

    Hi rodrigomc:
    Sorry for the delay in responding. To answer your questions:

    1) Try the below:

    Code:
    <script type="text/javascript">
    
    function loadwindow(selectid){
    var selectelement=document.getElementById(selectid)
    var selectedoption=selectelement.options[selectelement.selectedIndex]
    if (!/ignore/i.test(selectedoption.className))
    iframewin=dhtmlwindow.open("examplebox", "iframe", selectedoption.value, selectedoption.text, "width=590px,height=350px,resize=0,scrolling=1,center=1")
    }
    
    </script>
    
    <form>
    <select id="winlist">
    <option value="http://google.com">Example</option>
    <option value="http://yahoo.com" class="ignore">Example 2</option>
    <option value="http://digg.com">Example 3</option>
    </select> <a href="#" onClick="loadwindow('winlist')">Load Selected Window</a>
    </form>
    In other words, you can give options that you don't wish to launch a DHTML window a class name of "ignore".

    2) A DHTML window is really just an IFRAME on the page, so to have links that appear within it load in the main page, just give them a target="_top" attribute. Of course, this only works if you have access to the external page (ie: both pages are within your own domain).

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
  •