/    Sign up×
Community /Pin to ProfileBookmark

Mouseover event doubts

Hi folks ..

Iam pretty new to this JS development .. here Iam trying one simple program like there is one table with a mouse over event ad this mouse over event is having a function like on mouseover the height of the table increased to 100px and this height incremented to 100px on every mouse over.

then i include a if condition which tells the browser to shrink the table height to 50px once it is reached to 1000px of height. But this logic is happening for only one time … after the table shrinks to 50px height if i mouse over the logic is not working … please folks explain why this not happening

code snippet
===========

var x = 0;
function growthHeight() {
x = x + 100;
document.getElementById(‘table’).style.height=x+”px”;
if (x>=1000)
{
document.getElementById(‘table’).style.height=50+”px”;
}
}

<BODY>
<table id=”table” onmouseover=”growthHeight()” style=”border:1px solid #456466; height:50px;” >
<tr><td valign=”bottom” ><div>he he he he</div></td></tr>
</table>
</BODY>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@DokOct 20.2008 — You have to reset x once a height of 1000 is reached.
[CODE]if (x>=1000) {
document.getElementById('table').style.height=50+"px";
x = 0;
}[/CODE]
Copy linkTweet thisAlerts:
@JCwebdevauthorOct 20.2008 — DOK thanks a lot Iam cleared now ?
×

Success!

Help @JCwebdev 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.20,
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,
)...