Let's continue with the correct code in an answer:
Re-doing the 2 year old post: Adding a "next" Button to displayform.aspx
Step #1 - Verify the Formula
The Formula:
="<img src=/_layouts/images/blank.gif onload=""{"
&"var TR=this;while(TR.tagName!='TR'){TR=TR.parentNode}"
&"var TABLE=TR;while(TABLE.tagName!='TABLE'){TABLE=TABLE.parentNode}"
&"var n=TR.rowIndex;"
&"var item=ctx.ListData.Row[n-1];"
&"var prev=n>1?ctx.ListData.Row[n-2].ID:false;"
&"var next=TABLE.rows.length-1>n?ctx.ListData.Row[n].ID:false;"
&"var thisID=GetUrlKeyValue('ID');"
&"if(thisID==TR.id.split(',')[1]){"
&"var url='<div style=float:{2}><a href='+document.location.pathname+'?ID={0}>{1} (ID:{0})</a></div>';"
&"var prevHTML=prev?String.format(url,prev,'Previous','left'):'<div style=float:left>This is the first Item</div>';"
&"var nextHTML=next?String.format(url,next,'Next','right'):'<div style=float:right>This is the last Item</div>';"
&"var HTML=String.format('<div style=position:relative;margin-top:0px>{0} This ID:{2} {1}</div>',prevHTML,nextHTML,thisID);"
&"this.parentNode.innerHTML=HTML;"
&"}else{"
&"this.parentNode.innerHTML=String.format('prev:{0} next:{1}',prev,next);"
&"}"
&"}"">"
Should display in a View for any List it is added to as:

Step #2 (only after Step #1 !!)
To add this to a Form page, see all steps in: Adding a "next" Button to displayform.aspx