Referencing an Attribute of the Calling Object

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



In the "imgSizeChange()" function below gets the error:

Microsoft JScript runtime error: 'imgSizeChange.caller.width' is null or not an object
The thread 'Thread 5C0' (0x5c0) has exited with code 0 (0x0).
The program '[1860] iexplore.exe: Script program' has exited with code 0 (0x0).


What is the correct way to get to the attributes of any img tag that calls "imgSizeChange()" ? Will it be necessary to explicitly pass the "img1" id to "imgSizeChange()" ?

<head>
	<script id=clientEventHandlersJS language=javascript>
	<!--

    lDim = 800;
    sDim = 600;
	
    function imgSizeChange()
    { if( imgSizeChange.caller.width === 1280 )
      { imgSizeChange.caller.width = lDim;
        imgSizeChange.caller.height = sDim;
      }
      else
      { imgSizeChange.caller.width = 1280;
        imgSizeChange.caller.height = 960;
      }
    }
-->
<script>
</head>
<body>
<IMG id="Img1" alt="" src="00009 2004-05-15 16_05_58.JPG"
 width="1280" height="960" language=javascript
 onclick="return imgSizeChange()"
>
</body>

--
If sj. appears in my email address remove it to respond directly.
It is a spam jammer.

.



Relevant Pages

  • Re: Running Login Script after establishing a VPN connection
    ... What calls up your VB Script program? ... This would be equivalent to your current VB Script program ... The network drive disconnects before the bat file ... Set WshShell = CreateObject ...
    (microsoft.public.windows.server.scripting)
  • Re: [SLE] backspace key and TERM var
    ... In konsole when I select the vt420pc terminal type it ... When I start my program using this script "script program" it works. ... backspace key gives me 0x08 an the delete key gives me 0x7f. ...
    (SuSE)