Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > hidden/visible divs

Reply
Thread Tools

hidden/visible divs

 
 
reikoshea@gmail.com
Guest
Posts: n/a
 
      04-19-2006
okay ive been working at this for probably 4 hours now, and I (not to
mention my boss) am pretty upset.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script src="AC_RunActiveContent.js" language="JavaScript"
type="text/javascript"></script>
<script src="AC_Flash.js" language="JavaScript"
type="text/javascript"></script>
<script>
function show0(){
document.getElementByID('shift').style.visibility = 'visible';
}
function hide0(){
document.getElementByID('shift').style.visibility = 'hidden';
}
function show1(){
document.getElementByID('flash').style.visibility = 'visible';
}
function hide1(){
document.getElementByID('flash').style.visibility = 'hidden';
}
function doTimer() {
var timeout
timeout = setTimeout("show1();hide0();", 30000);
}

function changePic(newContent) {
document.images['main'].src = newContent;
show0()
hide1()
window.cleartimout(timeout)
doTimer()
}
</script>
</head>

<body>
<div style="position:absolute;top:0px;left:0px;visibili ty:hidden;"
id="shift"> <img src="pics/dvd.jpg" width="300" height="220"
name="main"> </div>
<div style="position:absolute;top:0px;left:0px;visibili ty:visible;"
id="flash">
<noscript>


<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="300" height="220">
<param name="movie" value="shift.swf">
<param name="quality" value="high">
<embed src="shift.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="300"
height="220"></embed></object>
</noscript>
<script language="JavaScript" type="text/javascript" >
<!--
AC_RunFlContentX ("movie", "shift" , "quality", "high" ,
"bgcolor", "#FFFFFF" , "src", "shift" , "width", "300" , "height",
"220" , "name" , "shift", "id", "shift");
//-->
</script>
</div>
</body>
</html>



The function is called from a parent frame. When a user clicks on a
thumbnail, the shift.swf (rollover animation) movie is supposed to
become invisible and the new image should take its place. After 30
seconds, it should revert back to the way it was until another change
function is called.

Its really depressing cause i know the fix is going to be something
very simple.

 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      04-19-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> okay ive been working at this for probably 4 hours now,
> and I (not to mention my boss) am pretty upset.

<snip>

> The function


Which function? (I see six, and two imported JS files (presumably full
of functions themselves)).

> is called from a parent frame.


So there is more HTML and script that is not shown. That means that
this cannot be tested to determine how it behaves in any environment.
Though it probably could not be tested anyway as the swf files, images
and eternal javascript files would be needed to do that. This is
probably a case where providing the URL on an online example of this
problem would be most appropriate.

> When a user clicks on a thumbnail, the shift.swf (rollover
> animation) movie is supposed to become invisible and the new
> image should take its place. After 30 seconds, it should
> revert back to the way it was until another change
> function is called.


That is what it is supposed to do, but what does it actually do? Are any
errors generated?

> Its really depressing cause i know the fix is going to be
> something very simple.


No reproducible demonstration of the issue, no description of symptoms.
The best responses you are likely to get will be random wild guesses;
mine is javascript pseudo-protocol HREFs. Simple to fix but an example
of pure coincidence if they are even relevant

Richard.


 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      04-19-2006
getElementByID should be getElementById note the lowercase D in Id. I
also change visibility to display note the differences. Here is some
very simple code that works after 3 seconds but only once...

<html>
<head>
<title></title>
<script type="text/javascript">

function HideIt(){
document.getElementById('shift').style.display = 'inline';
document.getElementById('flash').style.display = 'none';
}

function ShowIt() {
document.getElementById('shift').style.display = 'inline';
document.getElementById('flash').style.display = 'none';
}

function doTimer() {
var timeout
timeout = setTimeout("ShowIt();", 3000);
}

</script>
</head>
<body onload=doTimer()>
<div style="display:none;" id="shift">SHIFT</div>
<div style="display:inline;" id="flash">FLASH</div>
</body>
</html>

 
Reply With Quote
 
Reiko
Guest
Posts: n/a
 
      04-19-2006
yeah....i knew this would be something simple. Lower case D. Thats
all it took. Works exactly how i wanted it to...now to add netscape
and older IE versions.

I guess ive just typed it so many times that when i copy and pasted it
5 times it should have been right the next 5 times. I know this
mistake wont happen again...

Thanks for the help.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
swapping divs -- when divs NOT positioned absolutely.. maya Javascript 4 11-16-2007 05:11 PM
Managing divs within divs.... rich HTML 0 02-02-2006 07:38 PM
Nested DIVs - is there a better way? Guadala Harry ASP .Net 2 10-26-2004 07:30 PM
asp.net and divs mikieg_99 ASP .Net 6 07-30-2004 01:19 PM
Re: DIVs and overflow scroll bars S. Justin Gengo ASP .Net 0 07-18-2003 02:18 PM



Advertisments