473,233 Members | 1,553 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,233 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 1893
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
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.