Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Javascript visibility/dispaly problems with Firefox
Old 01-11-2010, 04:54 AM Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
Hi

I'm trying to get the following code to work with non IE browsers and am failing miserably. It creates three buttons and once you move your mouse over a button a text description is supposed to appear nearby. It works fine in IE but not in others. Have changed visibility to display and this still doesn't work. Please help

<html>
<head>
<script language="javascript">

var descriptions = new Array();
descriptions[0] = "<p>See whats been added to the web site recently</p>";
descriptions[1] = "<p>Find out more about me</p>";
descriptions[2] = "<p>Check out my links</p>";

function showDescription(descriptionIndex)
{
if (document.all)
{
DescriptionDiv.style.visibility = "visible";
DescriptionDiv.innerHTML = descriptions[descriptionIndex];
}
else
{
document.DescriptionDiv.display = "none";
document.DescriptionDiv.document.open();
document.DescriptionDiv.document.write("<div class='DescriptionDivStyle'>");
document.DescriptionDiv.document.write(description s[descriptionIndex]);
document.DescriptionDiv.document.write("</div>");
document.DescriptionDiv.document.close();
}
}


function clearDescription()
{
if (document.all)
{
DescriptionDiv.style.visibility = "hidden";
}

else
{
document.DescriptionDiv.display = "block";
}
}
</script>


<style>
div {border-width:thin;border-style:ridge;border-color:red;width:250px;height:70px;visibilty:hidden ;}
.DescriptionDiv {position:absolute;left:120px;top:50px;}
</style>
</head>


<body>
<a href="whatsnew.htm" onmouseover="showDescription(0)" onmouseout="clearDescription()"><img src="home_over.png" border="0"></a>
<br />
<a href="about.htm" onmouseover="showDescription(1)" onmouseout="clearDescription()"><img src="about_over.png" border="0"></a>
<br />
<a href="links.htm" onmouseover="showDescription(2)" onmouseout="clearDescription()"><img src="home_over.png" border="0"></a>
<br />

<div id="DescriptionDiv" name="DescriptionDiv" class="DescriptionDiv"></div>
</body>
</html>
gregc is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-11-2010, 05:39 AM Re: Javascript visibility/dispaly problems with Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I'm surprised it works in ANY browser with the code so messed up!.

Here's a working one
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-11-2010, 06:07 AM Re: Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
Hi! Looks like exactly what i'm after but could you show the code too please?
Thank you
gregc is offline
Reply With Quote
View Public Profile
 
Old 01-11-2010, 06:34 AM Re: Javascript visibility/dispaly problems with Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
view the source for the page. It's all in there.


One day I will get around to writing it all up
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-11-2010, 09:01 AM Re: Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
Hi, I've view sourced the page and copied the html, js files and css files (all except the htc file). The page won't display properly - no big number pics or small number pics on my computer - is there something I'm missing?
gregc is offline
Reply With Quote
View Public Profile
 
Old 01-11-2010, 10:02 AM Re: Javascript visibility/dispaly problems with Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
maybe the images?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-11-2010, 10:57 AM Re: Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
This is going to sound daft but there are no images on the page
gregc is offline
Reply With Quote
View Public Profile
 
Old 01-11-2010, 11:03 AM Re: Javascript visibility/dispaly problems with Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0


Really does bugg*** up the hotlinking

The images are backgrounds
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-12-2010, 03:25 AM Re: Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
Ah Right
Sry to keep asking but i am still having a prob

I've got the code and rejigged it into a basic table but am having probs putting images in. My browser fails to recognise the image and just displays the missing image icon.

Here's the code

<html>
<head>
<title>...</title>
</head>
<body>


<table border="1" bgcolor="lightblue" width="400" height="400">
<tr>
<td>
<div id="t0" onmouseover="toggle('h0', this.id);" style="cursor:hand;"><img src="button1.jpg"></div>
</td>
</tr>
<tr>
<td><div id="t1" onmouseover="toggle('h1', this.id);" style="cursorointer;">2</div>
</td>
</tr>
<tr>
<td><div id="t2" onmouseover="toggle('h2', this.id);" style="cursorointer;">3</div>
</td>
</tr>
<tr>
<td><div id="t3" onmouseover="toggle('h3', this.id);" style="cursorointer;">4</div>
</td>
</tr>
</table>


<table border="1" bgcolor="yellow">
<tr>
<td>
<div id="h0">Put content for option 1 here</div>
<div id="h1">Put content for option 2 here</div>
<div id="h2">Put content for option 3 here</div>
<div id="h3">Put content for option 4 here</div>
</td>
</tr>
</table>



<script type=text/javascript>
var blocks = Array("h0","h1","h2","h3");
hideAll();

function hideAll()
{
for(i=0;i<blocks.length;i++)
{
eH = document.getElementById(blocks[i])
eH.style.display = 'none';
eH.style.visibility = 'hidden';
}
}

function toggle(id,sender)
{
hideAll();
var e = document.getElementById(id).style;
var disp = 'block';
var vis = 'visible';
e.display = disp;
e.visibility = vis;
}

</script>
</body>
</html>
gregc is offline
Reply With Quote
View Public Profile
 
Old 01-12-2010, 11:12 AM Re: Javascript visibility/dispaly problems with Firefox
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
and does button1.jpg exist in the location? (the same folder as the HTML file)
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2010, 03:20 AM Re: Javascript visibility/dispaly problems with Firefox
Novice Talker

Posts: 6
Trades: 0
Tch! No it didn't! Argh! Thanks for all your help
gregc is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Javascript visibility/dispaly problems with Firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34027 seconds with 12 queries