javascript - include external java script file in jsp page -


i have external javascript file named paging.js. following contents of file:

function pager(tablename,itemperpage){     this.tablename = tablename;     this.itemperpage = itemperpage;     this.currentpage = 1;     this.pages = 0;      this.init()= function(){         alert("init called ");         var rows = document.getelementbyid(tablename).rows;         var records = (rows.length - 1);         this.pages = math.ceil(records / itemperpage);     }      this.showpagenav = function(pagername,positionid){         alert("show page navi call");         var element = document.getelementbyid(positionid);         var pagerhtml = '<input src = "next.jpg" type="image">';         pagerhtml += '<input src = "next.jpg" type="image">' ;         element.innerhtml = pagerhtml;     } } 

now tried call init jsp page .

<script type="text/javascript">                         var pager = new pager('results',7);                         pager.init();                     </script> 

this code put before complete body part in jsp page.

for including page put line

<script type="text/javascript"                    src="${pagecontext.request.contextpath}/js/paging.js"></script> 

but can't able call init method. there me finding problem?

this line of code problem:

this.init()= function(){ 

change to:

this.init=function() { 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -