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

iframe content has the navigation bar

7
I thought I could do this with just CSS, but it's not working.

I have an html file header that contains the website banner and navigation bar.
The nav bar is a <ul> list of links to the various pages, and CSS makes them look like buttons.

I include that file using an <iframe> element in my other pages.

when a user clicks a menu button (about us, home, etc.) the change in color isn't saved. The hover works - so it looks selected - and then the new page comes up and the selection disappears.

If I want to use a js script to force it to check highlighting, how do I get at the <li> elements? If I'm in index.html, for example, I have the <iframe> element, but I wouldn't think that the current document would conain the <li> elements of the navigation bar. If I'm in the header.html, then I don't know what page I'm on (i.e. what page is including the header) to know which menu item should be highlighted.

Any ideas on how I can do this?

Thanks!
Sep 9 '09 #1
3 4220
acoder
16,027 Expert Mod 8TB
The iframe document contains the li elements, so once you have that you can loop through to get them. As for saving the colour change, you can use a cookie or the URL to save the change. If you're using a server-side language, remove the iframe and include the navigation in each page.
Sep 9 '09 #2
maffy
7
Thanks for the quick reply!
I solved my problem by having one file with the header and footer, and loading the other pages into an iframe in the center of that file - depending upon which navigation button the user clicks.

now I have a new problem. I have a contact form, and want to do some validation. I added a:

onsubmit="return validateForm()"

to the form tag, and I am testing with bad data to see the errors (which are spans to the right of the fields. If there's an error, the innerHTML of the span is filled in, otherwise, nothing appears there.) so I know that the validateForm() is returning false.

Here's the problem -- the whole current page is trying to fit in the iframe in the center of the page. I'm not seeing the form at all, but I get two headers, two nav bars -- seriously ugly and not useful.

Is there anyway to force re-display of the form itself in the frame like it is before the user hits submit?

THANKS!
Sep 10 '09 #3
acoder
16,027 Expert Mod 8TB
If you can, I would advise you to drop the idea of using iframes. That depends largely on if you're using a language server-side, e.g. PHP, JSP.

If you can't, you'll need to set the action of the form to the page contained within the iframe, not the main parent page (which contains the navigation as well as the iframe).
Sep 10 '09 #4

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

Similar topics

1
by: Alexander | last post by:
Scroll IFrame Content to desired Position (JavaScript) ====================================== How can I scoll the content of an Ifram to a desire Position? The function should be:...
1
by: Alexandre Jaquet | last post by:
Hi I'm still working on iframe and now I'm looking for the way to get and update iframe content. example I want to do something like : from my mainform : ...
2
by: J-T | last post by:
Hello, I have an iframe which its scr is set to show a url (am image) .I am put this iframe on a user control and I am loading that user control dynamically to my Default.aspx.Now I need to...
9
by: aatcbbtccctc | last post by:
Hi folks I've googled for an answer to this, with no success. Can someone please jump in, and put me out of my misery! (I'm sure it's quite simple) I have an invisible IFRAME, and a visible...
1
by: mike888 | last post by:
I want to create dynamic iframe content like below but in Firefox <iframe width="100%" height="100" src="#"></iframe> <script language="JavaScript"><!-- document.frames.document.open();...
3
by: coat | last post by:
hello I would like the first 200 dots of iframe content to be skipped (so the iframe content top is 200 dots from the real top). it should not be able to scroll up those 200 dots. how can that be...
9
by: jad2006 | last post by:
Hi guys We have a requirement like in one iframe we have to show one site and in another iframe we have to show some other external site, we did it using <iframe src="http://www.a.com">...
5
by: perhapscwk | last post by:
is there any ways to modify output in a iframe content? so let say if I have a website, now due to some reasons, i need to makesure all words like "the" become "xxx", if we can chnage all words in...
2
by: isarajeev | last post by:
I have a aspx page, say 'abc.aspx'. Within that page i have 4 tab controls. The tab controls open as iframe. I also have a print option on my page.(an anchor) <a id="aPrint" runat="server"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.