PDA

View Full Version : object = this



john love
Mar 11th, 2007, 09:47 PM
I am working with someone else's javascript code snippet:

To begin with, here are the snippets:


function chip(its_id, its_width, its_height)
{
this.id = its_id

// etc.
}

function movechips()
{
chip1.move() // they use move("chip1")

// etc.
}

function move() // they have function move(id)
{
// theChip = this - doesn't work in IE (Win) ??
eval ("theChip = " + id) // this works for them

// etc.
}

function initchips()
{
chip1 = new chip("chip1", 46, 67)

// etc.
}

In the BODY, there is:


<body onload="initchips(); movechips()">

<div id="chip1">
<img width="46" height="67"
src="DHTML_GIFs_Folder/Balloons/balloon2.gif" alt="balloon 1" />
</div>

etc.




Reference the move() function; why doesn't:

theChip = this

work in IE/Win. It definitely works on all major Macintosh Browsers.

Thanks in advance.

marilynn.fowler
Mar 11th, 2007, 11:38 PM
Please post the code in its entirety or post a link to the code.