This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

document.links[0].onclick getting is null error in firefox 9 working fine below version 9

  • 1 reply
  • 1 has this problem
  • 7 views
  • Last reply by user633449

more options

in js I have written following line of code to navigate back , home pages. this code works fine upto version 8 but not working in version 9 and above

<a href="#" onClick="goBack();" >Back to Previous</a> 

function goBack(){
 
 		//Disabled the action of the link after first click to avoid repeated click events-Sreejesh
 		//once the action is compleated It  will be activated by the function 'doCommonLoad' in commonfunctions.js   		
 		
 		objLinks = document.links;
 		alert(objLinks.length);
			for(i=0;i<objLinks.length;i++){
				alert(objLinks[i]);
				if(objLinks[i].onclick.toString().indexOf("goBack")>0){
					objLinks[i].style.color="grey";
					objLinks[i].removeAttribute('onClick');
				}
			}
		
 
    if(taskList == true){
         if (secondFrame == "tasklistframe") {
                    hideFrame("inboxframe");
                    minimizeFrame("tasklistframe");
					
               } else {
                    hideFrame("tasklistframe");
                    minimizeFrame("inboxframe");
					}
				  			 	
            }
   
    // if(twoFrames = false)
	// {
	// maximize('maincontentframe');
	// }
	if(document.getElementById("statusbar").style.display == 'none')
	{
	document.getElementById("statusbar").style.display = 'block';
	}
	document.getElementById("mainMin").style.visibility = "visible"
	
	parent.document.getElementById("hiddenframe").src="hidden.jsp?action=MENU_GO_BACK";
	 }

it gives error in js as -- objLinks[i].onclick is null when I click on the link

in js I have written following line of code to navigate back , home pages. this code works fine upto version 8 but not working in version 9 and above <br /> <pre><nowiki><a href="#" onClick="goBack();" >Back to Previous</a> function goBack(){ //Disabled the action of the link after first click to avoid repeated click events-Sreejesh //once the action is compleated It will be activated by the function 'doCommonLoad' in commonfunctions.js objLinks = document.links; alert(objLinks.length); for(i=0;i<objLinks.length;i++){ alert(objLinks[i]); if(objLinks[i].onclick.toString().indexOf("goBack")>0){ objLinks[i].style.color="grey"; objLinks[i].removeAttribute('onClick'); } } if(taskList == true){ if (secondFrame == "tasklistframe") { hideFrame("inboxframe"); minimizeFrame("tasklistframe"); } else { hideFrame("tasklistframe"); minimizeFrame("inboxframe"); } } // if(twoFrames = false) // { // maximize('maincontentframe'); // } if(document.getElementById("statusbar").style.display == 'none') { document.getElementById("statusbar").style.display = 'block'; } document.getElementById("mainMin").style.visibility = "visible" parent.document.getElementById("hiddenframe").src="hidden.jsp?action=MENU_GO_BACK"; }</nowiki></pre> ---------------------------------------------------- it gives error in js as -- objLinks[i].onclick is null when I click on the link

Modified by cor-el

All Replies (1)

more options

The following forum is a better place to ask about web development issues. http://forums.mozillazine.org/viewforum.php?f=25

Before doing that though, you should try this with Firefox 16.0.1.Update Firefox to the latest release