java jsp包含其他页面,在jsp页面中包含外部Java脚本文件

I have an external JavaScript file named paging.js. Following are the contents of the 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 = '';

pagerHtml += '' ;

element.innerHTML = pagerHtml;

}

}

Now I tried to call init from my jsp page like .

var pager = new Pager('results',7);

pager.init();

This code i put before complete my body part in my jsp page.

For including this page I put line like

But i can't able to call init method. Is there anyone to help me for finding problem?

解决方案

This line of code is the problem:

this.init()= function(){

Change it to:

this.init=function() {

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值