/    Sign up×
Community /Pin to ProfileBookmark

moving div location

[QUOTE]

<body>
<input type=”button” onclick=”shift()” value=”<<“/>
</div>
<div id=”one”>
testlkjlkjhlkjhlkhjl<br />
kjhlkjhlhjljhljgjhgfjtes<br />
tlkjlkjhlkjhlkhjlkjh<br />
lkjhlhjljhljgjhgfjtestlk<br />
jlkjhlkjhlkhjlkjhlkjh<br />
lhjljhljgjhgfjtestlkjlk<br />
jhlkjhlkhjlkjhlkjhlhjl<br />
jhljgjhgftestj</div>

<div id=”two”>
adsfad
</div>

<div id=”three”>
adsfadsa
</div>

<script type=”text/javascript”>
var Width = browserWidth()/2;
var Height = browserHeight()-250;

var oneID = document.getElementById(‘one’).style;
oneID.width = Width+”px”;
oneID.height = Height+”px”;
oneID.top = “200px”;
oneID.left = (browserWidth()/4)+”px”;

var twoID = document.getElementById(‘two’).style;
twoID.width = Width+”px”;
twoID.height = Height+”px”;
twoID.top = “200px”;
twoID.left = (browserWidth()/4)+Width+(browserWidth()/8)+”px”;

var threeID = document.getElementById(‘three’).style;
threeID.width = Width+”px”;
threeID.height = Height+”px”;
threeID.top = “200px”;
threeID.left = (browserWidth()/4)+Width+(browserWidth()/8)+”px”;

function shift()
{
var move = (browserWidth()/8)*5;
oneID.left -= move;
twoID.left -= move;
threeID.left -= move;

}[/QUOTE]

It is messing up because oneID.left == ‘somenumber’px so when I try to subtract it comes up as (somenumber)px-(move)
replace the perens with numbers

somehow I need the digits only for oneID.left

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@DokOct 20.2008 — [CODE]parseInt(threeID.left)[/CODE]
Copy linkTweet thisAlerts:
@Xtrme_XJauthorOct 20.2008 — ehhh Duh thanks alot!
×

Success!

Help @Xtrme_XJ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...