473,395 Members | 1,584 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,395 software developers and data experts.

Frames and Classes

I have a web page with two frames, navigation and content. The nav
uses classes like so
<td align="center"
id="main"
style="cursor:pointer;"
onClick="parent.main.location.href='main.html'"
onMouseOver="this.className='nav0'"
onMouseOut="this.className='nav1'"
class="nav0">Main Page</td>

The class nav1 is the default state.
The class nav0 is the "lit" state.

What I need to do is make the "button" light up when a given page is
loaded and remain that way.

OnLoad of main.html, I can do:
onLoad="parent.frames['nav'].document.getElementById('main').className='nav0'"

Of course, once the mouse passes over the button, onMouseOut it
returns to the default state.

Is there a way to make the "lit" state persist?

While I am writing this, a possibility has crossed my mind. The
location of the content frame can evaluated and return the proper
class:

onMouseOut="
if (parent.content.href.indexOf('main')) {
this.className='nav0';
} else {
this.className='nav1';
}"

Or am I mixing JS and DHTML? My specialties are PHP and Perl and I am
into my 16th hour today. The words blur and sleep beckons. ;-)

TIA for any assistance!

Tom (aka Tyrone Slothrop)

Jul 23 '05 #1
1 1094
Tyrone Slothrop <ts@paranoids.com> wrote in message
news:89********************************@4ax.com...
I have a web page with two frames, navigation and content. The nav
uses classes like so
<td align="center"
id="main"
style="cursor:pointer;"
onClick="parent.main.location.href='main.html'"
onMouseOver="this.className='nav0'"
onMouseOut="this.className='nav1'"
class="nav0">Main Page</td>

The class nav1 is the default state.
The class nav0 is the "lit" state.

What I need to do is make the "button" light up when a given page is
loaded and remain that way.

OnLoad of main.html, I can do:
onLoad="parent.frames['nav'].document.getElementById('main').className='nav0
'"
Of course, once the mouse passes over the button, onMouseOut it
returns to the default state.

Is there a way to make the "lit" state persist?

While I am writing this, a possibility has crossed my mind. The
location of the content frame can evaluated and return the proper
class:

onMouseOut="
if (parent.content.href.indexOf('main')) {
this.className='nav0';
} else {
this.className='nav1';
}"

It would be less hideously written as:
onMouseOut="this.className=(parent.content.href.in dexOf('main')>-1?'nav0':'n
av1'";

Better still, don't write it at all.

Put this code in your navigation page:
------------
var linkIndex=0; // or set to another initial value

for(var i=0,len=document.links.length; i<len; i++) // assign all link
mouseout events
document.links[i].onmouseout=function(){setLink(linkIndex)}

function setLink(n)
{
linkIndex=n;

for(var i=0,ll=document.links.length; i<ll; i++)
document.links[i].className=(n==i)?'nav1':'nav0';
}

setLink( linkIndex ) ;
----------

Then each content page would call setLink with a unique index:

parent.frames['nav'].setLink( 2 ); // In page corresponding to third link

--
S.C. http://makeashorterlink.com/?H3E82245A

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: LM | last post by:
Hi, Assume I have a java.awt.Frame running in my main Thread. This frame is the main UI for my application. Is it possible for this application to create a second frame in a completely separate...
4
by: Simon Erikson | last post by:
Hello: I would like to build an app consisting of a "root" frame that can contain an arbitrary number of child frames (the user will click to create them). Each of these child frames needs the...
7
by: David Hayes | last post by:
I tried finding an answer on http://www.quirksmode.org/ without success. I am attempting a complicated Frames structure. I have made it work in IE, but not Netscape. I begin with three...
95
by: Neal | last post by:
Of course, every frame site I've ever seen has reduced usability and all. We've been through this before. But as frameset is still a part of HTML, there must be some legitimate use for it, hmm?...
25
by: Steal | last post by:
Hi at all I try to validate this page using the link: http://validator.w3.org/ but it return that this is not a valid HTML 4.01 page please where is it error? Steil <!DOCTYPE HTML PUBLIC...
6
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at...
7
by: dj Bass | last post by:
simple, they don't like things that restrict the server-side controls... and when it comes to frames, you need client side stuff and that stuff's up the asp.net strategy. right or wrong?
4
by: arnaudk | last post by:
I am trying to come up with a class design to deal with asynchronous data to be stored and analyzed over multiple time frames and could really use some design input. This is a rather long question...
56
by: Deepan HTML | last post by:
Hi All, Currently i am working in a framed environment where i have divided the window as 20% and 80% and the 20% is used for navigation purpose and right frame for displaying the orignal content....
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.