SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prototype Window Class

    Hello,

    I'm having a little bit of troubles setting up Prototype Window Class

    The instructions are quite straightforward and installing it is not a problem. There are some great examples too:

    http://prototype-window.xilinus.com/samples.html

    My question is: how do you make the windows appear only via using links? The sample codes provided in the above link only show the code to present the window when the page is load, not when a link is clicked (like the way I want it).

    I'm not too savy with programming so any insights would be greatly appreciated. Thanks in advance!

  2. #2
    I ♥ PHP
    Join Date
    Jul 2003
    Location
    Melbourne, Australia
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there teddyhwang and welcome to Sitepoint.

    Very nifty library they have available, thanks for bringing it to my attention. Do you have a page setup where you are implementing this that I can take a look at. What you will need to change is how the functions are fired.

    I will take a stab in the dark and assume you have something along these lines in your HTML file:
    HTML Code:
    <script type="text/javascript">
      ...
      window.onload = functionToOpenWindow();
    </script>
    What you need to do is remove that function and place it on the link you wish to open the window:
    HTML Code:
    <a href="#" onclick="functionToOpenWindow(); return false;">Open Window</a>
    If you post a test page I'll be able to show you the exact code that needs modifying.

    Regards,
    Jordan

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    window with links

    Hi teddyhwang, welcome to the forums,
    The page you posted a link to has lots of examples of "links" that open windows.
    Looking at the page source code shows
    HTML Code:
            <script>Application.addTitle('Open a simple window', 'open_window1')</script>
    
            <p class="description">
                This sample opens a simple window with some parameters like specific hide and show effects.
            </p>
            <script>Application.addShowButton('open_window1')</script>
    So it seems the function addTitle prides the link to the new window. And addShowButton shows the viewsource div that's in the mark-up but hidden.

  4. #4
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for the warm welcome and the quick responses!

    J Windebank, here's a test link for you to have a look at. I tried your suggestion and right now, as you can probably tell, the window will load as the page is loaded but once it's closed, the link does not work.

    Mittineague, thanks for the support. Unfortunately, I believe the author of the library used his own personal script for his sample page. The page is unique as it uses some kind of javascript that allows users to edit the code directly and see the results. The source of the samples page has additional JS that is not included with the library.

    Again, I appreciate the warm welcome and thanks in advance for your continued support

  5. #5
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a curteous bump to those that missed my post. Thank you in advance for your help!

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    additional code

    Quote Originally Posted by teddyhwang
    The source of the samples page has additional JS that is not included with the library.
    I don't see anything saying you can't use a copy of that file for yourself. You should be OK unless you intend to sell it.
    Do you have a test page online?

  7. #7
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi teddyhwang,

    got to this forum as I went into the same problem when I tried to get it working.

    Have a look at the "MIT-style license" link on the Introduction page of the class, it does not use the special application.js file.

  8. #8
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Novice prototype question

    Hi everyone, I have what I think is a fairly basic question about the prototype window library (0.96.3).

    My main page creates a "main menu" window which contains the content of a main menu URL (e.g. url:mainmenu.html).

    Links in that main menu are designed to create other windows. This is working fine, except that the windows open in the main menu window, not in the main page. In other words, I am getting nested windows within windows.

    Is there a way to control at which level new windows appear? I am guessing that if I wasn't referencing a URL, i.e. loading content via innerHTML, then it would work, however I have a fairly complex main menu which is much more convenient to manage via a URL reference.

    Thanks to anyone who can help!

    PS. No live sites yet, I am still in the conceptual stage for my app.

  9. #9
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague View Post
    I don't see anything saying you can't use a copy of that file for yourself. You should be OK unless you intend to sell it.
    Do you have a test page online?
    I'm not even sure how to use it. it seems to be a customized for his site. I had a test link up above your post.

  10. #10
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    prototype windows class

    Hi arian and gregwmay a belated welcome to the forums.
    I make quite a few posts, and I'm afraid this thread got pushed off my "recent posts" page, so it's been off my "radar" for a while.
    Are all 3 of you experiencing the same problem, or are they different problems using the same library?
    Please bring me up-to-date by stating exactly what the problem is now.

  11. #11
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If this thread is inactive due to that the problem is solved I'm sorry, if not here is som code that will work (for me at least):

    In the head include:
    Code:
    <script type="text/javascript" src="js_prot_win/prototype.js"> </script> 
    <script type="text/javascript" src="js_prot_win/effects.js"> </script>
    <script type="text/javascript" src="js_prot_win/window.js"> </script>
    <link href="js_prot_win/default.css" rel="stylesheet" type="text/css" >	 </link>
    <link href="js_prot_win/mac_os_x.css" rel="stylesheet" type="text/css" >	</link>
    <script type="text/javascript" src="js_prot_win/application.js"> </script>
    In the body:
    Code:
    <a href="javascript:box('test1', 'Test1', 'test1.php')">TEST1</a>
      <a href="javascript:box('test2', 'Test2', 'test2.php')">TEST2</a>
    
    <script type="text/javascript">
    function box(id, header, s) {
    	var win = new Window (id, {className: "mac_os_x", title: header, 
                                                  top:70, left:100, width:300, height:200, 
                                                  resizable: true, maximizable:false, url: "http://yourdomain.com" + s, showEffectOptions: {duration:3}})
    win.setCookie();
    win.setDestroyOnClose();
    win.show();                      
    }
    </script>
    I hope I understod the problem

    Anyone got the WindowsStore.init() to work?


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
  •