Debt Consolidation - Find jobs - Deaf Topics - Watch Anime - Debt Consolidation

PDA

View Full Version : body onload BROKE my AJAX star rating system


JinRoh
Feb 19th 2007, 3:12 am
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>


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
-----------------------------------------------------

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 19th 2007, 5:59 am
Ok, I receveived this email, but I don't see an Reply here.

nico_swd has just replied to a thread you have subscribed to entitled - body onload BROKE my AJAX star rating system - in the JavaScript forum of Digital Point Forums.

This thread is located at:
forums.digitalpoint.com/showthread.php?t=248032&goto=newpost

Here is the message that has just been posted:
***************
Just a thought, but you could try this if the "body onload" isn't working.


<SCRIPT LANGUAGE=JavaScript>
Scrolling = 0;
function ScrollWin() {
while(Scrolling != 700) {
this.scroll(1,Scrolling)
Scrolling++;
}
}

window.onload = ScrollWin;
</SCRIPT>

***************



I Forgot to say that I already tested that, Removing onload= and setting window.onload does the same problem

nico_swd
Feb 19th 2007, 6:25 am
I deleted my post cause I replied too fast and figured it wouldn't work for you.

JinRoh
Feb 19th 2007, 6:37 am
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 :(

nico_swd
Feb 19th 2007, 7:50 am
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>

JinRoh
Feb 19th 2007, 9:17 am
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 19th 2007, 2:12 pm
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 21st 2007, 12:57 am
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 25th 2007, 2:27 pm
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!

mhancoc7
Feb 22nd 2009, 7:48 pm
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!

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 22nd 2009, 8:07 pm
Nevermind...

http://www.sitepoint.com/forums/showthread.php?t=507137

Thanks, Jereme