I have the following Javascript code
add_num = {
f: function(html, num) {
alert(this.page);
},
page : function() {
return parseInt(this.gup('page'));
},
gup : function(name) {
name = name.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
var regex = new RegExp('[\\?&]'+name+'=([^&#]*)');
var results = regex.exec(window.location.href);
if(results == null)
return '';
else
return results[1];
}
}
But when I call add_num.f() what I get from alert() is the actual code of page. That is, it returns
function() {
return parseInt(this.gup('page'));
}
I was expecting a numeric value and not any code at all.