Help with OBJECT DOESN"T SUPPORT

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Reed

    Help with OBJECT DOESN"T SUPPORT

    Hello,

    I have a function that runs at load time and throws a an "Object Doesn't
    Support This Propertiy or Method" jscript error.

    The offending line is "if (type != "undefined" ) ". If I change the check to
    "type != """...I get no error...any ideas?

    var thePath = "";
    var type = ""
    var type = typeof parent.ory_butt on;
    if (type != "undefined" ) {
    type = typeof parent.ory_butt on.getTreePath( );
    if (type != "undefined" ) {
    thePath = parent.ory_butt on.getTreePath( );
    }
    }
    document.write( thePath);


  • Dom Leonard

    #2
    Re: Help with OBJECT DOESN"T SUPPORT

    Paul Reed wrote:[color=blue]
    > I have a function that runs at load time and throws a an "Object Doesn't
    > Support This Propertiy or Method" jscript error.
    >
    >
    > var thePath = "";
    > var type = ""
    > var type = typeof parent.ory_butt on;[/color]
    Comment: defining the same variable twice is not useful. Simply omit the
    first declaration assigning the null string.
    [color=blue]
    > if (type != "undefined" ) {
    > type = typeof parent.ory_butt on.getTreePath( );[/color]
    This line is calling the getTreePath method instead of ascertaining if
    it exists. Try
    type = typeof parent.ory_butt on.getTreePath; // then:[color=blue]
    > if (type != "undefined" ) {
    > thePath = parent.ory_butt on.getTreePath( );
    > }
    > }
    > document.write( thePath);
    >[/color]

    Alternatively, try:

    var thePath = "";
    if(parent.ory_b utton && parent.ory_butt on.getTreePath)
    thePath = parent.ory_butt on.getTreePath( );
    document.write( thePath);

    HTH
    Dom




    Comment

    Working...