body onload BROKE my AJAX star rating system

Discussion in 'JavaScript' started by JinRoh, Feb 19, 2007.

  1. #1
    Hello, I have an specific question. I run a website (www.CHETOS.es) and I am using a star rating system that was working well until I set up 2 JS scripts to scroll the window.

    You can see here:
    
    <SCRIPT LANGUAGE=JavaScript>
      Scrolling = 0;
      function ScrollWin() {
        while(Scrolling != 700) {
        this.scroll(1,Scrolling)
        Scrolling++;
        }
      }
    </SCRIPT>
    
    Code (markup):
    http://www.chetos.es/error/onload.php

    This website has <BODY onload="ScrollWin()">

    And If you try to rate a Star (you can test whatever you want, it's a test DB) if will go to another website and say
    
    Parse error: syntax error, unexpected T_VARIABLE in /home/.latitia/jinroh/chetos.es/error/db.php on line 41
    Code (markup):
    -----------------------------------------------------

    If you enter http://www.chetos.es/error/noonload.php

    It has only <BODY> (no onload, but it's the same website, just that was changed)

    And you try to rate something, it works and it says Votado!, it you do the same (noonload.php) and write javascript:ScrollWin() (like if you did onload... it's the same).

    Then you try to rate, and it works!!!.

    Does anybody knows why?? :( I have tried with another JS script and it happens the same,so it's not because of the JS script particularly.

    Thanks for your help! Hope you know how to fix it.

    BTW, the ajax rating system is this http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/
     
    JinRoh, Feb 19, 2007 IP
  2. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ok, I receveived this email, but I don't see an Reply here.

    I Forgot to say that I already tested that, Removing onload= and setting window.onload does the same problem
     
    JinRoh, Feb 19, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    I deleted my post cause I replied too fast and figured it wouldn't work for you.
     
    nico_swd, Feb 19, 2007 IP
  4. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Oh, ok sorry. I thought it was a forum bug or something. Well, as I said, I have tried with <body onload> and window.onload with the same result :(
     
    JinRoh, Feb 19, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    The only reason that I can think of why this won't work is that a variable conflicts with other's from the rating script. Give this a try.
    
    <script type="text/javascript">
    Scrolled = 0;
    
    function ScrollDown()
    {
    	while (Scrolled != 700)
    	{
    		window.scroll(1, ++Scrolled)
    	}
    }
    
    window.onload = ScrollDown;
    </script>
    
    Code (javascript):
     
    nico_swd, Feb 19, 2007 IP
  6. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    It doesn't work... Same problem :(

    PS: Oh! I did replace the files from the script, with the original ones (I changed a bit and translated to Spanish) and now it isn't telling that ERROR, it just Refresh the website, do the same (scroll) and the vote is counted!!! (but it's not ajaxian... )

    Maybe something with the window.onload / body onload?? Why is it refreshing??

    I can post here script files if you want to take a look.

    Test this in same URL, or directly here : http://www.CHETOS.es/error/

    Thanks for helping, compatriot.
     
    JinRoh, Feb 19, 2007 IP
  7. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Still stucked here. So is there any possibility so I could make it without "onload"?? (Maybe is because that is refreshing?)

    http://www.chetos.es/error/

    As I said before, now it "works" but REFRESHING the website... not as it should do (if I remove the onload or window.onload it works) without refreshing.
     
    JinRoh, Feb 19, 2007 IP
  8. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nobody knows what can I do?? As I said, it """can""" be a problem of onload?? I can use anything instead onload?? What should I do? :(

    I don't know why is this happening :'(
     
    JinRoh, Feb 21, 2007 IP
  9. JinRoh

    JinRoh Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Still having the problem, (Now it DOES vote, but it DOES Refresh so it's not AJAXian :/ )


    It does refresh when the Scroller script is called, in body onload, or in a non-onload way (for example

    <script type="text/javascript">
    ScrollDown();
    </script>

    )

    You can test it in http://www.CHETOS.es/error/ (as I said you can test all the times you want, it's a test DB)

    What can I do?? Why is it refreshing?? If you look in www.CHETOS.es and vote, it doesn't refresh!

    Thanks!
     
    JinRoh, Feb 25, 2007 IP
  10. mhancoc7

    mhancoc7 Guest

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I know this is a super old script, but I am facing the same issue. Did you ever get this fixed?

    Thanks, Jereme
     
    mhancoc7, Feb 22, 2009 IP
  11. mhancoc7

    mhancoc7 Guest

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #11
    mhancoc7, Feb 22, 2009 IP