/    Sign up×
Community /Pin to ProfileBookmark

Javascript does not work in Firefox, why?

I’ve written a javascript, but its not working in Firefox, i don’t know why not ?

Also i like to change someting to the script.
Is it possible to change this:

[code=html]newheight=200;
if(theheight<newheight){[/code]

to this: (the newheight should be he height of another div, i tryed the code below but it isnt working)

[code=html]newheight=document.getElementById(content1).offsetHeight;
if(theheight<newheight){[/code]

My complete code:

[code=html]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<link href=”ww.css” rel=”stylesheet” type=”text/css” />
<script type=”text/javascript”>
function grow(targetid){
theheight=document.getElementById(targetid).offsetHeight;
newheight=200;
if(theheight<newheight){
document.getElementById(targetid).style.height=theheight+0,1+’px’;
}else{
document.getElementById(“content”).innerHTML = document.getElementById(“content1”).innerHTML;
}
}
setInterval(“grow(‘content’)”,1);
</script>
</head>

<body>

<div id=”header”></div>
<div id=”content”></div>
<div id=”footer”></div>
<div id=”content1″ style=”visibility:hidden”>dit is de oude inhoud<BR /><BR />asdfsadfsds</div>
</body>
</html>
[/code]

And my css file:

[code=html]/* CSS Document */
body{
background-image:url(img/background.png);
background-repeat:repeat-x;
background-color:#619BCA;
text-align:center;
margin-top:0px;
}
div#header{
height: 464px;
width: 871px;
background-image:url(img/header.png);
}
div#content{
width: 754px;
height: 0px;
background-color: #A8C8E1;
border:1px solid #000000;
border-style:hidden;
border-width:1px;
border-color:#A8C8E1;
}
div#footer{
height: 22;
width: 871px;
background-image:url(img/footer.png);
}#thediv {
border:1px solid #000000;
background-color:#0000FF;
}[/code]

Maybe there is a better solution for this problem?
Sometimes it is shocking… and it could go some faster. But if i change it its shocking to much…
I hope you can help me….

And is there a posibility to fade the text into the div instead of just place it there ?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 25.2008 — document.getElementById(targetid).style.height=theheight+1+'px';
Copy linkTweet thisAlerts:
@felgallMay 25.2008 — In JavaScript all dimensions MUST specify the units (eg 'px'). It is only JScript that allows you to leave the units off and have pixels assumed.
Copy linkTweet thisAlerts:
@FangMay 26.2008 — document.getElementById(targetid).style.height=theheight[COLOR="Red"]+0,1+[/COLOR]'px';[/QUOTE]
document.getElementById(targetid).style.height=theheight[COLOR="Green"]+1+[/COLOR]'px';
×

Success!

Help @Jelmer850i 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.27,
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,
)...