IE 6: Revealing All Onload
Oct 10, 2006
I'm new to DOM and javascripting and have constructed a hide/show menu. I can't find a way to keep IE6 from revealing all the sub-lists onload. The code (inspired by PPK and Jeremy Keith's recent books) follows:
window.onload = function () {
var topnav = document.getElementById ("navmain");
var parent = document.getElementsByTagName("ul");
for (var i=0;i<parent.length;i++) {
if (parent[i].className != "section") continue;
parent[i].style.display = "none";
var header = parent[i].previousSibling;
if (header.nodeType != 1)
header = header.previousSibling;
header.relatedTag = parent[i];
header.onclick = openClose;
}
}
function openClose () {
var currentValue = this.relatedTag.style.display;
var newValue = (currentValue == "none") ? "block" : "none";
this.relatedTag.style.display = newValue;
}
Markup:
<div id="navmain" class="clearfix">
<ul><li><h4>Markets</h4>
<ul class="section">
<li><a href="/corporate/">Corporate</a></li>
<li><a href="/govt/">Govt/Agency</a></li>
<li><a href="/municipal/">Municipal</a></li>
<li><a href="/mbsabs/">MBS/ABS/CDO</a></li>
<li><a href="/funding/">Funding</a></li>
</ul>
</li></ul>
</div>
Hoping for some simple solution, but all advice is welcome.
View 6 Replies
ADVERTISEMENT
May 5, 2010
I am having trouble with the following code. Right now the user clicks the button and it shows all of the blogs from the blog array. However I want it to just reveal 2 then two more and two more and so on as the user clicks button. I have tried multiple things but can't seem to get it right. Most of the things i try either reveal the entire blog on start or when the user clicks hides all of them.
[Code]...
View 1 Replies
View Related
Aug 15, 2011
Below is the code for a Facebook "Like" button. When I click the Like button, I would like it to show some html code below.
[Code]....
View 4 Replies
View Related
May 4, 2005
I need to implement a pretty basic javascript functionality in my site, but have never used it and wonder if there is a script available or if someone can give me the basics.
I have a nav bar at the top of the page with four links, and then divs for each of the links. The link you click on displays the associated div and hides the rest of them. Pretty simple, right?
View 2 Replies
View Related
Nov 13, 2001
I'ld like to insert a feature seen in www.k10k.net and www.rangermag.com whereby once a link is clicked it instantly reveals a hidden layer - seems a great way of quick navigation of info.
View 1 Replies
View Related
Mar 15, 2010
I am a relatively inexperienced programmer and what I want to do here is to have an onClick for a div that reveals a random hint (one at a time) from a selection of 3 (they are all currently on top of eachother and hidden using body onLoad.)
[Code]...
View 3 Replies
View Related
Aug 25, 2010
I was just wondering if there is a JavaScript tutorial online that shows you how to do similar hover effect to what Twitter does with the trending topics. Such as Inception. When you hover over it and a black bubble appears. Also I'm not sure what it is called.
View 1 Replies
View Related
Oct 9, 2011
I'm using a bog standard script which reveals content when something is clicked. This script works fine everywhere else (or it did before I tweeked it a bit to get it to work on this one page; an easy thing to do), however, on this one page, it shows the content, but messes up the layout.
[Code]...
View 4 Replies
View Related
Jan 11, 2010
I am trying to create a basic menu where if you put your mouse over a button you get a bit of descriptive text or an image appearing somewhere else on the page. I have tried to do this with hiding/revealing hidden divs - works fine with IE but no others.
<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 me links</p>";
function showDescription(descriptionIndex){ .....
View 2 Replies
View Related
Oct 16, 2009
I have hidden div, that i want to show by sliding it in from topborder.The problem is that i don't know how to make it "slide in" instead of"wipe in".I want it all to move with it's content instead of showing more andmore of it.
View 1 Replies
View Related
Jul 23, 2005
I'm having a hard time figuring out why the onload event is not being
called for the frameset window in the following simple example. It is
being called for each of the component frames. Code:
View 5 Replies
View Related
Dec 3, 2005
I wander what gets loaded the fastest (1-2 or 3) in what succession:
<head>
<script type="text/javascript">
function andAction() {
// doing stuff
}
</script>
</head>
<body onload="andAction();">
<script type="text/javascript">andAction()</script></body>
just in the head and nothing more
This I am sure off:
<head>
<script type="text/javascript">
window.onload = function andAction() {
// doing stuff
}
</script>
</head>
<script type="text/javascript">andAction()</script></body>
just in the head and nothing more (should be 1)
Third and last which is faster:
body onload or window.onload
View 3 Replies
View Related
Jul 23, 2005
I'm seeing a difference in behaviour between
window.onload = f();
and
<body onload="f();">
Specifically, window.onload appears to fire before all the elements of
the page have been rendered. As the difference is consistent across
IE/Moz/Opera, I'm assuming it's deliberate - can anyone point me
towards where this behaviour of window.onload is defined in the
documentation? TIA. Code:
View 2 Replies
View Related
Mar 28, 2009
<html>
<head>
<title>Braxton's Homepage</title>
</style>
<link rel="stylesheet" href="normal.css" />
<style type="text/css">
div#secret{
border: medium double black ;
[Code]...
why this doesn't work! It's supposed to make the "secret" div reappear.
View 2 Replies
View Related
Jun 2, 2010
I'm looking for a javascript/css code that can do the following, for a click button:
- When mouse is not over the click-button, a text should be displayed at the right of the button, in a bordered textbox - 85% transparency (hardly visible)
(- when mouse hovers over the button, the button image changes to a different one <- I know how to do this)
- When the button is clicked the text shows up normaly (0% transparency)
- When clicking again the button OR anywhere else on the page, the text goes back to 85% transparency.
View 2 Replies
View Related
Sep 13, 2005
Say I have serveral controls, all of which need to emit clientside script to
execute on page load. They can't emit to OnLoad = <functionname> because
then only one of the scripts will get executed. Is there a way around this?
View 4 Replies
View Related
Aug 4, 2006
there is a Onload that happens when I refresh a page and I get an
Alert() as debug thinkg but the alert() doesn't happen when I delete a
record using a link on the same page!
Why? any idea?
View 1 Replies
View Related
May 3, 2007
I have two functions that need to run when the page is open. I cannot combine them making one single function as from the one depends the further working of the page.
I tried oninit eventhandler (one function i put in onload event while the another one i put in the oninit) but the function from oninit handler was not fired.
View 4 Replies
View Related
Jul 23, 2005
I need to execute a JavaScript function "onload". The only problem is I
don not have access to the <body> tag as it is a part of the standard
page-header include (a separate file). How could I have certain pages
execute my function() onLoad?
The function basically just sets the original values of fields so that I
can determine if a field has been changed or not, which aleviates unnec.
sql update on the backend..
View 9 Replies
View Related
Jul 23, 2005
I thought that if I have:
....
<body onload="some_script();">
....
that some_script would not be called until the <body> was completely
loaded - is this not the case? With Safari 1.3 I seem to have to delay
inside some_script (there is some php in the <body> that slows down the
loading). Since I happen to have a spare iframe in my <body>, I load a
tiny bit of html in it whose job is simply to set a "loaded" flag,
tested inside my delay code.
What I was observing was that some fields inside a <form> in the <body>,
whose values are set by some_script, were, with Safari, not visible
until I clicked in one of them - then they all popped into sight. I
wasn't seeing this with other browsers and a delay mechanism fixed it.
It was as if the onload was triggered as soon as it was encountered
rather than when the loading was complete.
View 11 Replies
View Related
Aug 12, 2005
i wish the html to submit the form once it is loaded. what should be the code here (alert("how 's the code here"))? Code:
View 2 Replies
View Related
May 10, 2006
Is it just me or did something change?
The following works under IE but not FF:
function window.onload() {
alert(0);
}
The following works under both IE and FF:
window.onload = function() {
alert(0);
}
I'm using Firefox 1.5.0.3.....
View 1 Replies
View Related
Mar 15, 2007
I havent used java that much, and lately I updated from M$ java to SUN
(due to my bank).
Before, this worked:
<body onload="SetFocus(); window.focus();">
now, it does not. SetFocus() is included as:
<script language="JavaScript" src="mystuff.js"></script>
Though, this gives an alert:
<body onload="SetFocus(); window.focus();alert('hello')">
What is the difference and the trick here?
View 7 Replies
View Related
Jul 20, 2005
Why doesn't this seem to work?
var win;// window handle
function onloadfunction( arg ){// replace cnn with google
win.navigate( "http://www.google.com" );// never executes
}
win = window.open("http://www.cnn.com", "win", ""); // open window
with CNN
win.onload = onloadfunction;// set onload funciton
but never see google displayed!
View 1 Replies
View Related
Jun 6, 2007
This has been frustrating. Works perfectly fine in Firefox, but just dies in IE. The onload doesn't seem to want to work when the function is in the head script, but if I put all the script in the body, it loads slower. I've tried window.onload, but it doesn't seem to work well since my images need to be modified after it loads.
View 1 Replies
View Related
Feb 9, 2008
Does onload always have to be in the <body> tag?
View 2 Replies
View Related