473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Javascript issues with Mozilla

Hi, I'm having trouble with my javascript in Mozilla. I'm trying to use onClick within a link to call hidden divs in page. This seems to function properly in IE and Safari but not Mozilla. I would appreciate any feedback.


javascript in header:

[HTML]<script language="javascript">
<!--

function changeLinks(link) {


if (link=="1") {

window.LinksInternal.style.display = '';
window.LinksExternal.style.display = 'none';
window.LinksQuick.style.display = 'none';

}

if (link=="2") {

window.LinksInternal.style.display = 'none';
window.LinksExternal.style.display = '';
window.LinksQuick.style.display = 'none';

}

if (link=="3") {

window.LinksInternal.style.display = 'none';
window.LinksExternal.style.display = 'none';
window.LinksQuick.style.display = '';

}

</head>
[/HTML]
code in body:

[HTML]
<a onClick="changeLinks(3);return false;" style="cursor:hand"><img border="0" src="/images/quicklinks3.gif" class="right" ></a><a onClick="changeLinks(2);return false;" style="cursor:hand"><img border="0" class="right" src="/images/externallinks3.gif" ></a> <a onClick="changeLinks(1);return false;" style="cursor:hand"><img border="0" class="right" src="/images/internallinks3.gif" ></a><BR>[/HTML]
Dec 19 '07 #1
7 1332
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

try to use:

Expand|Select|Wrap|Line Numbers
  1. window.LinksInternal.style.display = 'block';
instead of setting it to an empty string :)

kind regards
Dec 19 '07 #2
Dasty
101 Expert 100+
And fix referencing too, because it is invalid. Make it this way:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('LinksInternal').style.display = '';
Dec 19 '07 #3
gits
5,390 Expert Mod 4TB
And fix referencing too, because it is invalid. Make it this way:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('LinksInternal').style.display = '';
yup ... of course ... and ensure you have the corresponding id set to the node ...

kind regards
Dec 19 '07 #4
Hi Friends, thank you for the prompt replies. I've tried both your recommendations and am still having trouble except this time it's not working in IE either.

[HTML]function changeLinks(link) {


if (link=="1") {

document.getElementByID('LinksInternal').style.dis play = '';
document.getElementByID('LinksExternal').style.dis play = 'none';
document.getElementByID('LinksQuick').style.displa y = 'none';

}

if (link=="2") {

document.getElementByID('LinksInternal').style.dis play = 'none';
document.getElementByID('LinksExternal').style.dis play = '';
document.getElementByID('LinksQuick').style.displa y = 'none';


}

if (link=="3") {

document.getElementByID('LinksInternal').style.dis play = 'none';
document.getElementByID('LinksExternal').style.dis play = 'none';
document.getElementByID('LinksQuick').style.displa y = '';


}


}
[/HTML]

called via onClick here:
[HTML]
<div id="LinksContainer" >
<a onClick="changeLinks(3);return false;" style="cursor:hand"><img border="0" src="/images/quicklinks3.gif" class="right" ></a><a onClick="changeLinks(2);return false;" style="cursor:hand"><img border="0" class="right" src="/images/externallinks3.gif" ></a> <a onClick="changeLinks(1);return false;" style="cursor:hand"><img border="0" class="right" src="/images/internallinks3.gif" ></a><BR>

<% Call fn_getLinksExternal(2) %>
<% Call fn_getLinksInternal(2) %>
<% Call fn_getLinksQuick(2) %>


</div>[/HTML]
Dec 19 '07 #5
gits
5,390 Expert Mod 4TB
getElementById ... note that javascript is case-sensitive

kind regards
Dec 19 '07 #6
getElementById ... note that javascript is case-sensitive

kind regards
works now, many many thanks for catching that!
Dec 19 '07 #7
gits
5,390 Expert Mod 4TB
no problem ... glad to hear you got it working :) ... post back to the forum anytime you have more questions

kind regards
Dec 19 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.