SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: Floating Window

  1. #1
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Floating Window

    Hello,
    I found this script which I would like to use:

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

    I can see the code i need to use for a standard box on the intro page but cannot see how i would get a box to open when a user clicked a link?

    Thanks

    Neil

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There are sample codes in the documentation. So you just wrap the code into a function and call it:
    Code:
     function show(){
      //code here
     }
    Code:
     <span onclick="show()">Click Here</span>
    Saul

  3. #3
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wrap what code into a function?

    Also, where would i place this code:

    Code:
    var win = new Window(Application.getNewId(), {className: "spread", title: "Ruby on Rails", 
                                                  top:70, left:100, width:300, height:200, 
                                                  resizable: true, url: "http://www.rubyonrails.org/", showEffectOptions: {duration:3}})
    win.show();
    Thanks

    Neil

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rctneil
    Wrap what code into a function?

    Thanks

    Neil
    Just like I showed in the example. OK, here's one of the samples found in the documentation:

    Code:
    <script type="text/javascript">
    function show(){
    var win = new Window(Application.getNewId(), {className: "dialog", width:350, height:400, zIndex: 100, resizable: true, title: "Sample window", showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, draggable:true}) win.getContent().innerHTML= "&lt;div style='padding:10px'&gt; Lorem ipsum dolor sit amet,...&lt;/div&gt;" win.setStatusBar("Status bar info"); win.showCenter();
    }
    </script>
    <span onclick="show">Click Here</span>
    Saul

  5. #5
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    I put that code into my page along with the css link and javascripts links showed on the intro page of the site above and when i click the text i put in, i get "Error on page" showing in the status ba?

    Thanks
    Neil

  6. #6
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What does it say?
    Saul

  7. #7
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It says precisely that "Error on page"! but whats wrong with the code you posted to make it say that?

    Thanks

    Neil

  8. #8
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should the <script> part be in the <head> tag or not?

    Thanks

    Neil

  9. #9
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    www.atmania.com is the page i have put it on. Could you check the source code?

    The link right at the bottom - add content is the one which should activate it

  10. #10
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You have a closing } missing for function show().

    Also include /javascripts/effects.js and /stylesheets/themes/default.css
    Saul

  11. #11
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added in the missing }. But it still does not work so please can you check the source again.

    Thanks

    Neil

  12. #12
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You didn't include /javascripts/effects.js and /themes/default.css. The script won't work without these.

    Code:
    	<script type="text/javascript" src="/javascripts/effects.js"> </script>
    	<link href="/themes/default.css" rel="stylesheet" type="text/css" >	 </link>
    Saul

  13. #13
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I added those and it still does not work. Does the <script> have to go in the head tag?

    Thanks

    Neil

  14. #14
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Their site is a real mess. All of their instructions are incomplete and inaccurate.

    Use this code for show() function:
    Code:
     win = new Window('window1', {className: "mac_os_x", title: "Sample", width:200, height:150});
    win.getContent().innerHTML = "<h1>Hello world</h1>";
     win.setDestroyOnClose();
     win.showCenter();
    Saul

  15. #15
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Used that code and still get an error.

    ????????

  16. #16
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You've lost the closing bracket again.
    Saul

  17. #17
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn - Still get an error.

    Thanks

    Neil

  18. #18
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah, you moved the show() above the included script files, move it down. It can be in the head, but below the includes.
    Saul

  19. #19
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Nope, Error Again!

    Just taken the () out of the show in the link you click. When i tried that i got a white page with this on it:

    function show(){ win = new Window('window1', {className: "mac_os_x", title: "Sample", width:200, height:150}); win.getContent().innerHTML = "
    Hello world
    "; win.setDestroyOnClose(); win.showCenter(); }

    Try the link yourself and see!

    Thanks

    Neil

  20. #20
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Try this for a link:
    Code:
    <a href="javascript:show()">
    Saul

  21. #21
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using that i get the standard error.

  22. #22
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If i take the () from the link then i get the same result on the white page with text

  23. #23
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Please leave the brackets, the error is deeper, removing the brackets won't help.
    Saul

  24. #24
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok,
    I have readded the brackets and i still get the error.

    THanks

    Neil

  25. #25
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Who's an idiot here? It's not you so it must be me. Guess who forgot to upload the files to go along with the script!!!!!!!

    ARGH!!! - Thanks so much for helping out though.

    Thanks

    Neil


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
  •