SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Spain
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with CBE

    First sorry for my bad english, i hope you understand me:

    Ok, the problem is the following:

    I use this:

    Code:
    <script language="JavaScript" type="text/JavaScript">
    function centerlayer() {
      var e1 = document.getElementById('absolute').cbe;
      var e3 = document.getElementById('relative').cbe;
      e1.moveTo(e3.pageX(), e3.pageY());
    }
    </script>
    I call the function on body...

    Code:
    <body onResize="centerlayer()">
    And there arenīt any problem, layer absolute move to layer relative position when i resize the window.. but if i try to call function with onload instead onresize...

    Code:
    <body onLoad="centerlayer()">
    simply doesnīt work... :/ i donīt understand why but if y call the same function with to diferent events.

    Code:
    <body  onResize="centerlayer()" onLoad="centerlayer()">
    Onload call doesnīt work and.... onresize doesnīt work...

    In conclusion the function only work when i call it with resize event... can anybody tell to me how to run it with onload event, please?

  2. #2
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Spain
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nobody understand my problem? perhaps my english is too bad :S

  3. #3
    SitePoint Enthusiast rjahrman's Avatar
    Join Date
    May 2003
    Location
    Washington, USA
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, your English isn't that bad. I think that people just don't know the answer to your question.

  4. #4
    SitePoint Member
    Join Date
    Feb 2004
    Location
    France
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink

    try to replace the function name "centerlayer" by "windowOnload"

  5. #5
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Spain
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Astonduo
    Thanks for all guy!

    Definitively I must study more javascript and quite english.

    Regarths from Spain ( Seville )

  6. #6
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good work, astonduo.

    CBE captures the window.onload event - you can "hook" into it by defining a function named "windowOnload". This function is called during the window.onload event. Do not use <body onload="windowOnload">.

    wopper, I'm glad you like CBE - thanks for using it. You might also want to take a look at the X library - which is my latest dhtml library - I consider it to be better than CBE in many ways.


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
  •