javascript not defined function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bilibytes
    New Member
    • Jun 2008
    • 128

    javascript not defined function

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

    Code:
    //widget functions
    			//1.
    				//when the mouse is over a star, we want to change all the stars below to selected stars
    				function oMOver(starNum){
    					//replace stars
    					i=1;
    					while(document.getElementById(i) != null){
    						if(i <= starNum){
    							document.getElementById(i).style.backgroundImage ="url(/images/taken_star.png)";
    						}
    						else{
    							document.getElementById(i).style.backgroundImage ="url(/images/free_star.png)";
    						}
    					i++;
    					}
    					//replace span message
    					var messg=new Array();
    					messg[1]="Crap";
    					messg[2]="Still Crap";
    					messg[3]="Lost my Time";
    					messg[4]="It's worth it";
    					messg[5]="Nice!";
    					
    					document.getElementById("rate_widget").lastChild.innerHTML = messg[starNum];
    				}
    				
    			//1.1
    				//when the mouse goes out of the stars div, we want to show the average rate
    				function oMOut(actualRate, numRatings){
    					i=1;
    					while(document.getElementById(i) != null){
    						if(i <= actualRate){
    							document.getElementById(i).style.backgroundImage ="url(/images/taken_star.png)";
    						}
    						else{
    							document.getElementById(i).style.backgroundImage ="url(/images/free_star.png)";
    						}
    					i++;
    					}
    					document.getElementById("rate_widget").lastChild.innerHTML = numRatings+"ratings";
    				}
    				
    				
    			//2.
    				//when the user click on the selected star submit rating to server
    				function oCKStateChange(){
    					if(objectXHR.readyState == 4){
    						if(objectXHR.status == 200){
    						
    							//store result
    							rWResponse = objectXHR.responseText;
    							window.document.getElementById("rate_widget").innerHTML = rWResponse;
    						}
    					}
    					else{
    					}
    				}
    			
    				function oCK(starNum){
    					var rateSentParameters= "rate="+starNum;
    					objectXHR.open("post","../rate.php", true);
    					objectXHR.onreadystatechange = oCKStateChange;
    					objectXHR.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    					objectXHR.send(rateSentParameters);
    				}
    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
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Where is the oCK function called?

    Comment

    • pradip030384
      New Member
      • Sep 2008
      • 3

      #3
      You have to defined java script fuction .

      Comment

      Working...