SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question simple prototype problem

    Hi guys does anyone know how for prototype to analyze the page once its done loading? I have this code:
    Code:
    				  if ($('background_type') == 'Image') {
    				    $('color_chart_1').hide();
    				  }
    However it does not initialize once the page is done loading, only when I click on the select box I am using it on... is there a simple solution for this?
    Have a good day.

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think what you're looking for is prototype's version of a "dom-ready" function.

    This should work:

    Code JavaScript:
    document.observe("dom:loaded", function() {
      // stuff here
    });

    More info here: http://www.prototypejs.org/api/document/observe
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    Have a good day.


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
  •