[thelist] inline style vs. predefinded (dhtml)
jelle desramaults
nsg_chong at hotmail.com
Mon Oct 15 03:09:52 CDT 2001
Dunno if this one has been asked before, i apologize if it has.
Basic problem :
I'm working on a (very simple) script that slides a layer. When i define my
style inline, everything works fine, when i predefine my styles .... nothing
works.
code that matters (dynduo code):
-------------------------------------------------
var block
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init()
{
if (ns4) block = document.blockDiv
if (ie4) block = blockDiv.style
block.xpos = parseInt(block.left)
}
function slide()
{
if (block.xpos < 300)
{
alert(bleh)
block.xpos += 5
block.left = block.xpos
setTimeout("slide()",30)
}
}
---------------------------------------
the code runs fine when i define my style inline, like this :
<DIV ID="blockDiv" STYLE="position:absolute; left:50px; top:100px;
width:30px; height:30px; clip:rect(0,30,30,0)">
when I predefine it however, the code doesn't work :
#blockDiv {position:absolute; left:50px; top:100px; width:30px; height:30px;
clip:rect(0,30,30,0)}
oh yeah... when i try to get the initial block.left value through an alert I
get : " NaN "
any insight is very much appreciated.
greets,
Jelle Desramaults
www.sitekick.be
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.282 / Virus Database: 150 - Release Date: 25/09/01
More information about the thelist
mailing list