473,698 Members | 2,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with Firefox 2.0 behavior with this script

1 New Member
Can somebody please help me, i tried playing around with IE6 and Firefox 2.0 browser for setting zIndexes and hide & show of divs. It seems to work to both. I tried repeatedly clicking on different divs on IE and no problem, but on firefox if I do the same, some divs just got hidden without notice. try clicking variably on different divs and it will happen...

How do I make this stable?

-----------------------------
[HTML]
<HTML>
<HEAD>
<TITLE>LAYER TEST</TITLE>
<script type="text/javascript">
<!--
var lastfocus;


function toggleBox(szDiv ID, iState) // 1 visible, 0 hidden
{
var obj = document.layers ? document.layers[szDivID] :
document.getEle mentById ? document.getEle mentById(szDivI D).style :
document.all[szDivID].style;
obj.visibility = document.layers ? (iState ? "show" : "hide") :
(iState ? "visible" : "hidden");
}
function doDelete(obj)
{
var deletePoint = document.getEle mentById(obj);
if (deletePoint.ha sChildNodes())
deletePoint.rem oveChild(delete Point.lastChild );

}

function deleteNode(obj)
{
var deleteSpot = document.getEle mentById(obj);
if (deleteSpot.has ChildNodes())
{
var toDelete = deleteSpot.last Child;
deleteSpot.remo veChild(toDelet e);
}
}

// -->
</script>
</HEAD>
<BODY>

<div id="first" onClick="
if(lastfocus==n ull)
{
lastfocus=this. id;
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
}
else {
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
getElementById( lastfocus).styl e.zIndex=getEle mentById(this.i d).style.zIndex-1;
lastfocus=this. id ;
}
" style="backgrou nd-color:silver;wi dth:300;height: 100;left:100;po sition:absolute ; top:300;">
<a onClick=";toggl eBox('btnfirst' ,1);toggleBox(' first',0);">[x]</a>
FIRST LAYER
</div>

<div id="second" onClick="
if(lastfocus==n ull)
{
lastfocus=this. id;
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
}
else {
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
getElementById( lastfocus).styl e.zIndex=getEle mentById(this.i d).style.zIndex-1;
lastfocus=this. id ;
}
" style="backgrou nd-color:yellow;wi dth:300;height: 100;left:130;po sition:absolute ; top:220;">

<a onClick="toggle Box('btnsecond' ,1);toggleBox(' second',0);">[x]</a>
SECOND LAYER
</div>
<div id="third" onClick="
if(lastfocus==n ull)
{
lastfocus=this. id;
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
}
else {
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
getElementById( lastfocus).styl e.zIndex=getEle mentById(this.i d).style.zIndex-1;
lastfocus=this. id ;
}
" style="backgrou nd-color:skyblue;w idth:300;height :100;left:160;p osition:absolut e; top:250;">
<a onClick="toggle Box('btnthird', 1);toggleBox('t hird',0);">[x]</a>
THIRD LAYER
</div>

<div id="fourth" onClick="
if(lastfocus==n ull)
{
lastfocus=this. id;
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
}
else {
getElementById( this.id).style. zIndex=getEleme ntById(lastfocu s).style.zIndex +1;
getElementById( lastfocus).styl e.zIndex=getEle mentById(this.i d).style.zIndex-1;
lastfocus=this. id ;
}
" style="backgrou nd-color:green;wid th:300;height:1 00;left:190;pos ition:absolute; top:170;">
<a onClick="toggle Box('btnfourth' ,1);toggleBox(' fourth',0);">[x]</a>
FOURTH LAYER
</div>


<script type="text/javascript">
<!--
var theElement=docu ment.getElement ById('first');
-->
</script>

<!-- To Hide The DIV -->
<input style="visibili ty:hidden" id="btnfirst" type="button" onClick="toggle Box('btnfirst', 0);toggleBox('f irst',1)" value="First" />
<input style="visibili ty:hidden" id="btnsecond" type="button" onClick="toggle Box('btnsecond' ,0);toggleBox(' second',1)" value="Second" />
<input style="visibili ty:hidden" id="btnthird" type="button" onClick="toggle Box('btnthird', 0); toggleBox('thir d',1)" value="Third" />
<input style="visibili ty:hidden" id="btnfourth" type="button" onClick="toggle Box('btnfourth' ,0); toggleBox('four th',1)" value="Fourth" />


</HTML>

[/HTML]
Nov 23 '06 #1
2 4570
sreine
1 New Member
Forgive me if this reply appears twice. There seemed to be an error when I hit submit the first time and I never saw the reply show up in the forum so and resending it.

I think I understand what is going wrong with your script as I am seeing the same thing with mine when I try to do getElementById( ).style.zIndex = getElementById( ).style.zIndex+ 1. I used firebug (great tool) to debug and the following is happening. If I happen to have a zindex of 14 and increment by 1, the result is 141, not 15. The addition being done is character based, not numeric. I have tried several workarounds, none solve the problem. I have researched the issue on the web (finally found this post) and the only other info I have found is a few people saying that the element on which the zindex is being referenced must have one of the position attributes set. Unfortunately, I already have position attributes set on all the div elements I am trying to operate on.

Maybe with this info, you can work a solution and share it with me,

thanks, Steve
Jan 30 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Hi Steve, welcome to The Scripts.

Try using parseInt on the zindex.
Jan 31 '07 #3

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

Similar topics

6
2475
by: R. Rajesh Jeba Anbiah | last post by:
In IE, I could be able to directly refer the "id", but it isn't possible in Firefox. Somewhere I read the solution is to refer the id like document.getElementById("month") in Firefox. If I do so, the script works well in Firefox, but IE throws error. (I have added the code snippet below). So, my question is: is there anyway to make the script work in all browser *without* any browser fix ie, without adding any browser detection check?...
3
10251
by: shreddie | last post by:
Could anyone assist with the following problem? I'm using JavaScript to hide/show table rows depending on the option selected in radio buttons. The script works fine in IE but in Firefox the hidden rows take up page space even though their content is not visible. I have extracted the necessary code as shown below: ************************************************************************
10
19163
by: Danny | last post by:
Hi all, I am having some odd problems with AJAX on Firefox (1.5). When I use GET as the request method everything works ok, but when I do a POST the remote function doesn't get the parameters I am passing to it. Everything works fine on IE 6. Here's a couple samples of what I am doing: // using GET url = 'http://www.myserver.com/cgi-bin/funct?key1=value1&key2=value2'
12
1882
by: Joel Byrd | last post by:
I am making an AJAX call when any one of a number of inputs in a form (search criteria) are clicked, checked, changed, etc. When the user clicks, checks, whatever, I am trying to display a "Retrieving results..." text. This should be really simple, but in IE, it does not work. Here's the code that is not executing in IE: And here is the context of that code, which is the AJAX function that is called when a radio button is clicked,...
1
2467
by: KPS | last post by:
I'm attempting to create a simple treeview-like behavior in JavaScript. The desired behavior happens in IE but I cannot get the same to happen in FireFox. The primary thing I want to accomplish is to set the id and href of some objects dynamically during the onload of the page instead of hard-coding it in the HTML. I want to set the id/href so when I add new entries I don't have to remember to increment the id's. In FireFox, the href...
18
3336
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I run the code on my local computer but I do have it when I run the code on geocities.
1
2443
by: Larax | last post by:
Alright, so here's the problem. I define a global variable in my script and then add methods/properties to it. Everything works great, no error in Javascript Console. But when I refresh site, several errors "variable is not defined" are displayed. What is more strange, the script is still working ! After each another refresh these errors are keep showing, only after I close site and open it again, these errors disappear, but only to next...
8
4168
by: Chris Cap | last post by:
I am getting some strange behavior when using RaiseCallbackEvent. I have a form that implements ICallbackEventHandler. During the client callback, a session variable is set that is used on the following page load. When debugging through using Visual Studio, everything works fine. When using Firefox, everything works fine. However, when I view the site outside of the debugger in IE, it displays incorrect behavior. The Session variable...
7
4037
by: mike57 | last post by:
The minimal AJAX script below works in Firefox, but not in IE, Opera, or Chrome. I could use some suggestions or referrals to resources that will help me get the script working in other browsers. Before there are six characters entered in the CAPTCHA code field, the 'Send' button is supposed to be disabled. When there are at least six characters in the CAPTCHA code field, the script attempts to verify the CAPTCHA w/AJAX. If it verifies, it...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2341
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.