Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2005, 07:08 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default length is null?

I must be missing something, but can someone tell me why this keeps giving me an error saying that length is null or not an object???

var redoIndex = new Array();
var currentRedo=0;

function analyzeResults()
{
    if (redoIndex.length > 0)
    {
        redoIndex = null;
        var redoIndex = new Array();
        alert (redoIndex.length);
    }
    else
        alert ("somethingelse");

}

 
Old October 18th, 2005, 09:46 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default

never mind... I'm a victim of blindly cutting and pasting...

 
Old October 19th, 2005, 12:22 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii darkhalf!!

The problem is with ur second var redoIndex = new Array();

Below is ur fixed one :)


<script>
var redoIndex = new Array();
var currentRedo=0;

function analyzeResults()
{


    if (redoIndex.length > 0)
    {
        redoIndex = null;

     redoIndex = new Array();

    alert (redoIndex.length);
    }
    else
        alert ("somethingelse");

}
</script>

<input type=button name=abc value=check onclick="analyzeResults()">

Hope this will help you

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
getting the length of an apstring 132591 C++ Programming 1 October 15th, 2006 10:46 PM
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
length crmpicco Classic ASP Basics 1 February 11th, 2005 11:24 AM
How to get the "Length" of a column Guillermo Hdez ADO.NET 0 October 29th, 2004 07:31 AM
Record length ?!? hcweb Classic ASP Basics 2 November 1st, 2003 11:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.