Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:18:54+00:00 2026-06-11T03:18:54+00:00

So I have this code, which is the output of a php file (hence

  • 0

So I have this code, which is the output of a php file (hence some stuff like 3 ratings, etc).

It works flawlessly in Firefox, but Chrome and IE act like the observers don’t even exist.

Also, the onmouseout function of #ratingwrapper is considered “not defined” in chrome and ie. It’s mind boggling why these two browsers are totally ignoring the JS, yet firefox sees everything.

I tried absolutely everything, even calling simple alerts, nothing works in ie and chrome. I tried removing the observers and doing everything in the #ratingwrapper div, but all functions are being “undefined” in chrome.

I’m using prototype, header js declarations are all in order, because other scripts using prototype are working on the page. There are no conflicts, etc. I’m stuck with this unexplainable bug.

<div class="ratings">
        <div class="rating-box" id="ratingbox">
            <div class="rating" id="ratingboxfill" style="width:100%"></div>
        </div>
    <div id="ratingwrapper" onmouseout="revertProductRating()"></div>
    <br /><br />
    <div id="curpos"></div>
    <div id="cpos"></div>
    <span class="amount">3 ratings</span>
    <input id="newRating" type="hidden" value="0" />
</div>

<script type="text/javascript">
    function setNewProductRating(e) {
        var ratingx = Event.pointerX(e);
        var ratingy = Event.pointerY(e);
        var containerLeft = Position.page($('ratingbox'))[0];
        var containerTop = Position.page($('ratingbox'))[1];
        var hpos = ratingx - containerLeft;
        var vpos = ratingy - containerTop;
        $("cpos").update(hpos+","+vpos);
        if (hpos <= 9) {
            revertProductRating(10)
            $("newRating").value=1;
        } else if(hpos <19) {
            revertProductRating(20)
            $("newRating").value=2;
        } else if(hpos <28) {
            revertProductRating(30)
            $("newRating").value=3;
        } else if(hpos <38) {
            revertProductRating(40)
            $("newRating").value=4;
        } else if (hpos < 47) {
            revertProductRating(50)
            $("newRating").value=5;
        } else if (hpos < 57) {
            revertProductRating(60)
            $("newRating").value=6;
        } else if (hpos < 66) {
            revertProductRating(70)
            $("newRating").value=7;
        } else if (hpos < 76) {
            revertProductRating(80)
            $("newRating").value=8;
        } else if (hpos < 85) {
            revertProductRating(90)
            $("newRating").value=9;
        } else if (hpos < 96) {
            revertProductRating(100)
            $("newRating").value=10;
        } else {
            revertProductRating()
        }
    }

    function revertProductRating(force=0) {
        if (force == 0) {
            //document.getElementById("ratingboxfill").style.width = "100%";
            $("curpos").update("force=0");
            $("ratingboxfill").setStyle({
                width: '100%'
            });
        } else {
            //document.getElementById("ratingboxfill").style.width = force+"%";
            $("curpos").update("force="+force);
            $("ratingboxfill").setStyle({
                width: force+'%'
            });
        }
    }

    function sendProductRating()
    {
        value = $("newRating").getValue();
                window.location = 'http://x.dev/y/' + 'ratingValue/' + value;
    }

    $('ratingwrapper').observe('mousemove', setNewProductRating);
    $('ratingwrapper').observe('click', sendProductRating);
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:18:56+00:00Added an answer on June 11, 2026 at 3:18 am

    You can’t define default argument values in javascript, so the function definition of revertProductRating is wrong.

    Try changing it to this:

    function revertProductRating(force) {
        if(arguments.length === 0) {
            force = 0;
        }
    
        if (force == 0) {
            //document.getElementById("ratingboxfill").style.width = "100%";
            $("curpos").update("force=0");
            $("ratingboxfill").setStyle({
                width: '100%'
            });
        } else {
            //document.getElementById("ratingboxfill").style.width = force+"%";
            $("curpos").update("force="+force);
            $("ratingboxfill").setStyle({
                width: force+'%'
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code which will include template.php file from inside each of these
I have a jquery function loading a php file which will output some data
I have this code which compiles and works as expected: class Right {}; class
I have this code which is passed to Paypal checkout: <?php foreach ($paypalBasket as
I have this code, which uses ob_start php function. Which basically puts the echoed
I have a config.php file which has some constants and methods. I have a
I have this code which adds a x number of views to a Multiview
I have this code which does the trick: #include <stdio.h> int main() { int
I have this code which is called at an onChange event of an function
I have this code which gets WP posts, but it gets all the posts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.