Results 1 to 4 of 4

Thread: this.style is null or not an object

  1. #1
    Join Date
    Nov 2009
    Posts
    140

    this.style is null or not an object

    Hello Folks,

    My project is stop running in the midway by giving the Microsoft JavaScript Runtime Error. The error which i am getting is occur dynamically. This happen every time when exception occurs at every postbag event in a Home.Aspx web page. The error is as follows:

    Microsoft Jscript runtime error: 'this.style' is null or not an object

    So now i need your help to get my program working perfectly. Thanks in advance. Waiting for reply

  2. #2
    Join Date
    Apr 2008
    Posts
    4,088

    Re: this.style is null or not an object

    Hello,

    If i am not wrong then you are using the onsubmit() method on the same function because of which your program is not responding. Its better to run it in the separate function to work properly to produce the the proper outcome. Here i am giving the code which will display the onsubmit() method in the separate function. So try your luck this time with the code given below.

    form runat="server" onsubmit="frmfirst_onsubmit()" id="Default">
    function frmfirst_onsubmit()
    {
    var _frmObj = document.getElementById('Default');
    _frmObj.style.cursor = 'hold';
    ShowXHideY('Hold for a moment', 'MainTable');
    }

  3. #3
    Join Date
    Apr 2008
    Posts
    2,139

    Re: this.style is null or not an object

    It is an Internet Explorer error caused by the attempt to access the non-existent style collection of document object. It can be corrected by changing a line in the "getOffsetParent' function by securing the "getStyle" from being called the document object.
    Here is the example to change the line:

    Code:
    while ((element = element.parentNode) && element != document.body)
    After converting the code:
    while ((element = element.parentNode) && element != document.body && element != document)

  4. #4
    Join Date
    Feb 2009
    Posts
    455

    Re: this.style is null or not an object

    First make sure that the ID of object which you are using is the object of the showError. It is because if you are using the UserControl or the MasterControl and then it is the server side control then ID could be recognized by the containers ID. For confirmation purpose to avoid this just right click on the page and go to the view source of the HTML and look for the control and check the generated ID property. That all i know about this.

    Hope it will work. Thank you.

Similar Threads

  1. Replies: 4
    Last Post: 19-02-2012, 04:29 PM
  2. Replies: 6
    Last Post: 06-06-2011, 01:34 AM
  3. Error - null or not an object
    By Solaris in forum Software Development
    Replies: 3
    Last Post: 26-11-2009, 02:35 PM
  4. Elements is null or not an object
    By KADRI in forum Software Development
    Replies: 3
    Last Post: 31-08-2009, 04:45 PM
  5. window.external' is null or not an object
    By Kelewyn in forum Technology & Internet
    Replies: 3
    Last Post: 19-08-2009, 07:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,922,710.17525 seconds with 17 queries