473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

javascript not defined function

bilibytes
128 100+
hi,
i am getting an error with this script:
"oCk is not defined
onclick(click clientX=0, clientY=0)"

Expand|Select|Wrap|Line Numbers
  1. //widget functions
  2.             //1.
  3.                 //when the mouse is over a star, we want to change all the stars below to selected stars
  4.                 function oMOver(starNum){
  5.                     //replace stars
  6.                     i=1;
  7.                     while(document.getElementById(i) != null){
  8.                         if(i <= starNum){
  9.                             document.getElementById(i).style.backgroundImage ="url(/images/taken_star.png)";
  10.                         }
  11.                         else{
  12.                             document.getElementById(i).style.backgroundImage ="url(/images/free_star.png)";
  13.                         }
  14.                     i++;
  15.                     }
  16.                     //replace span message
  17.                     var messg=new Array();
  18.                     messg[1]="Crap";
  19.                     messg[2]="Still Crap";
  20.                     messg[3]="Lost my Time";
  21.                     messg[4]="It's worth it";
  22.                     messg[5]="Nice!";
  23.  
  24.                     document.getElementById("rate_widget").lastChild.innerHTML = messg[starNum];
  25.                 }
  26.  
  27.             //1.1
  28.                 //when the mouse goes out of the stars div, we want to show the average rate
  29.                 function oMOut(actualRate, numRatings){
  30.                     i=1;
  31.                     while(document.getElementById(i) != null){
  32.                         if(i <= actualRate){
  33.                             document.getElementById(i).style.backgroundImage ="url(/images/taken_star.png)";
  34.                         }
  35.                         else{
  36.                             document.getElementById(i).style.backgroundImage ="url(/images/free_star.png)";
  37.                         }
  38.                     i++;
  39.                     }
  40.                     document.getElementById("rate_widget").lastChild.innerHTML = numRatings+"ratings";
  41.                 }
  42.  
  43.  
  44.             //2.
  45.                 //when the user click on the selected star submit rating to server
  46.                 function oCKStateChange(){
  47.                     if(objectXHR.readyState == 4){
  48.                         if(objectXHR.status == 200){
  49.  
  50.                             //store result
  51.                             rWResponse = objectXHR.responseText;
  52.                             window.document.getElementById("rate_widget").innerHTML = rWResponse;
  53.                         }
  54.                     }
  55.                     else{
  56.                     }
  57.                 }
  58.  
  59.                 function oCK(starNum){
  60.                     var rateSentParameters= "rate="+starNum;
  61.                     objectXHR.open("post","../rate.php", true);
  62.                     objectXHR.onreadystatechange = oCKStateChange;
  63.                     objectXHR.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  64.                     objectXHR.send(rateSentParameters);
  65.                 }
  66.  
is there an error in the function code?
because i can't see it.
or if you are aware of an external reason for this error
please let me know

thank you very much

bilibytes
Sep 26 '08 #1
2 1898
acoder
16,027 Expert Mod 8TB
Where is the oCK function called?
Sep 28 '08 #2
You have to defined java script fuction .
Sep 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Alex Fitzpatrick | last post by:
Just by way of introduction, I'm currently the principal developer and maintainer of the a JavaScript editor plug-in for Eclipse. https://sourceforge.net/projects/jseditor/ The plug-in as it...
1
by: Sylaris | last post by:
hi, i have a problem which recursion fits perfectly, however; after working with the base function (which has no errors and works correctly) the recursions return a "function not defined" error in...
7
by: Wm.M.Thompson | last post by:
For a computer programmer JavaScript is not difficult. It is pretty easy to look at some code for the first time and figure out what is going on. This is especially true if you have gratuated...
6
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you...
22
by: Christopher Nelson | last post by:
I have a little menu system which essentially takes HTML like: <div id='foo'></div> and retrieves foo.shtml from the server and inserts it inside the <div>. But sometimes I'd like foo.shtml...
1
by: Brian Kendig | last post by:
I've got some questions about using an external javascript file, included via '<script type="text/javascript" src="mycode.js" ></ script>': (1) If I define a function "myFunction()" in the...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
20
by: shapper | last post by:
Hello, How to create a namespace in Javascript containing two methods? And how to access those methods? Thanks, Miguel
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.