SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ajax comment package and onLoad

    Hi all,

    This is kind of a selfish question. But here goes.

    I am using this star rater here,
    http://www.masugadesign.com/the-lab/...ar-rating-bar/

    I am wondering if anyone else has used this package and been able to get it to work properly whilst using <body onload=""> functions?

    Seems that whenever you have an onLoad function in the <body> the star rating script no longer acts in an AJAX manner, and reverts to refreshing the page to record the rating you have added.

    Any suggestions are appreciated, thanks for reading!
    porle.

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is because you are overriding the onload that is set for the ajax rating.

    Also, it seems that this is discussed on the URL that you provided. I'd simply move your onload script to something like the following or use an event handler (search google for addEvent)

    Code:
    <script type="text/javascript">
        var oldonload = window.onload;
        window.onload = function() {
            // run what ever you want here
            oldonload();
        }
    </script>
    Its a dirty way to do it, but if you can't be sure how some code is writen i'd use the above. That way you can add to it without killing the previous like in your case.



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
  •