By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 2,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

javascript not defined function

bilibytes
100+
P: 128
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
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Where is the oCK function called?
Sep 28 '08 #2

P: 3
You have to defined java script fuction .
Sep 28 '08 #3

Post your reply

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