Any ideas?

Unable to get property ‘value’ of undefined or null reference

does anyone know what above msg mean and how to fix it?

It means you are asking for the value of something that doesn’t exist.
Can you post the script? Is it Javascript?

function navigate_records(text)
{

switch (text)
{
case 0:
  document.selection.next.value = parseInt(0);
  break;
case 1:
   document.selection.next.value = parseInt(document.selection.next.value) + 15;
   
  break;
case 2:
if(parseInt(document.selection.next.value)!= 0)
{ document.selection.next.value = parseInt(document.selection.next.value) - 15;}
  break;
case 3:
  document.selection.next.value = parseInt(counter);
  break;  
default:
}
testingvalidation(0); 

}

probably comes on the [COLOR=#464646][FONT=Helvetica Neue]document.selection.next.value = parseInt(document.selection.next.value) + 15; line as you are not checking if it exists before asking for the value.
If you look at case 2 in your switch, you have an if statement. Add a similar one to the case 1 part.

[/FONT][/COLOR]

I will try that now and will let you know. thanks.

still getting same error.

Hi,

Can you link to a page where we can see the error, or post enough code here (e.g. the appropriate HTML) that we can recreate your error.

If you do the latter, you could use this template:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
	
<style>

[COLOR="#FF0000"][I]your CSS here[/I][/COLOR]

</style>
	
</head>
<body>

[COLOR="#FF0000"][I]your HTML here[/I][/COLOR]

</body>

<script>

[COLOR="#FF0000"][I]your JS here[/I][/COLOR]

</script
</html>

<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset=“utf-8”>

<style>

your CSS here

</style>

</head>
<body>

<a onclick=“navigate_records(0); return(false);” href=“#”>First</a>|<a onclick=“navigate_records(1); return(false);” href=“#”>Next</a>|<a onclick=“navigate_records(2); return(false);” href=“#”>Previous</a>|<a onclick=“navigate_records(3); return(false);” href=“#”>Last</a

</body>

<script>

function navigate_records(text)
{

switch (text){

case 0:

  console.log('first page');
  document.selection.next.length;
  break;



case 1:
   console.log('second page');
   document.selection.next.value = parseInt(document.selection.next.value) + 15;
  break;

case 2:
if(parseInt(document.selection.next.value)!= 0)
{ document.selection.next.value = parseInt(document.selection.next.value) - 15;}
  break;

case 3:
  document.selection.next.value = parseInt(counter);
  break;

default:
}
testingvalidation(0);

}

</script
</html>

Ah ok.

document.selection doesn’t have (AFAIK) a next attribute. That’s why it’s returning undefined.
Also, I’m not sure how widely supported document.selection actually is.
I just tested it in Chrom, FireFox and IE and it only works in IE.

Depending on what you are doing, you should probably use window.getSelection(), which is the most cross-browser compatible.

it works on IE6 - IE8 but not on IE9 and IE10.
what is your suggestion i should do to solve this problem?

It depends.
What are you trying to do?

Im trying to get the next 15 record when a link is clicked.

OK, the next 15 records from where?
From a database?

yes.

Being a client-side scripting language JavaScript is not in a position to perform database operations per se.
One way of acheiving this is from your JavaScript, to submit an AJAX request to a PHP script, have the PHP script fetch the records from the DB, then return them (e.g. as JSON) so that your JavaScript insert them into the page.

BTW, I’m curious.
Knowing now what you are trying to do, what do you mean “it works on IE6 - IE8”?

the javascript that I mentioned on here earlier seems to be working ok in ie6 - ie8, but when tested in ie9 above all i get is this message “Error: Unable to get property ‘value’ of undefined or null reference

Hi,

I think we’re getting our wires crossed.
You can’t fetch records from a DB using document.selection

sorry if i confused you. i’m fetching records from DB using asp.vbscript and display them only the first 15 records at the time.
the function above is using to shows our next 15 of records and so on…

Ah ok, that makes much more sense :slight_smile:

So where are the records stored as far as JavaScript is concerned?

what do you mean? their stored in mysql.