Hi,
Earlier I posted a question asking how to stop DWT wiping out local code updates in pages attached to it. My code updates are to make the selection button of each sub-page remain highlighted so that it flags where you are.
So somebody sent me a good answer, which starts as follows:
In the DWT, set up an editable region in the <head> section and add an
embedded style block:
<!-- #BeginEditable "navstyle" -->
<style type="text/css">
#masthead a {color: green; /*style for the current page*/}
</style>
<!-- #EndEditable -->
Now, my style for the current page consists of quite a few lnes of CSS (about 10 lines, which come after/instead of "#masthead a {" in the above. So I was wondering, is it possible to replace all those lines with some class name or something? Otherwise, with say 20 sub-pages, I will have to repeat those 10 CCS lines in every file.
tia
avraham
-----------------------------------------------------------
Re: Updating DWT makes it overwrite my code; class/include
>> In the DWT, set up an editable region in the <head> section and add an
embedded style block:
Since I have a lot of CSS code lines for my style, is there any wasy of
specifying a class, or even an include file, instead of
{
styles for the current page*/
e.g., color: green;
/*etc.
etc.*/
}
tnx
- avi
>> In the DWT, set up an editable region in the <head> section and add an
embedded style block:
<!-- #BeginEditable "navstyle" -->
<style type="text/css">
#masthead a {color: green; /*style for the current page*/}
</style>
<!-- #EndEditable -->
</head>
One way round this using CSS without JavaScript, is to give each link an
id, and add CSS to each page that uses that id.
In the DWT, set up an editable region in the <head> section and add an
embedded style block:
<!-- #BeginEditable "navstyle" -->
<style type="text/css">
#masthead a {color: green; /*style for the current page*/}
</style>
<!-- #EndEditable -->
</head>
The a typical link would be:
<li><a href="he_pg02_About_my_Site.htm" id="about">About our
Site</a></li>
On the about page, change the embedded CSS to
#about a {color: green; /*styles for the current page*/}
Change #masthead on other pages to match the corresponding link id.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/
http://www.rxs-enterprises.org/fp
"Avi" <Avi@discussions.microsoft.com> wrote in message
news:AD0AED72-84D1-4103-85A0-E3006F92DE4A@microsoft.com:
> Hi all,
>
> I have a navigation bar and a method of highlighting the button that
> corresponds to the current page to which I have just moved. When using DWTs
> with this it seems to mess everything up.
>
> So I need either some JavaScript to highlight the button, something like
>
> <li><a href="he_pg02_About_my_Site.htm" onclick="<put JScript here">About
> our Site</a></li>
>
> or I need some EW VBA code to fix up what the DWT messes up.
> I suppose the JavaScript is the correct way to go. So I would appreciate it
> if somebody could write for this JScript-disadvatanged newbie the few lines
> of code I need to 'grab' a button and highlight its color while the user is
> browsing that button's target page.
>
> For anybody interested in knowing about how DWT messed things up, read on.
>
> 1. I have built a navigation bar using the method of using list items (<li>)
> as the "buttons" by defining #right_col li, #right_col a and #right_col
> a:hover.
>
> 2. To keep highlighted the button that corresponds to the current (sub)page
> I am using the method of giving the whole <body> an ID, e.g., like this for
> the "About my Site"
>
> <body id="about">
>
> 3. I have a class for each <li> item, like this:
>
> <li><a href="he_pg02_About_my_Site.htm" class="about">About our Site</a></li>
>
> 4. I have these body IDs and classes defined in the CSS file like this
>
> /* Highlighting definition */
> #home .home, #about .about, #links .links, #contact .contact
> {
> /* Style for highlighting the "button" of the current page */
> }
>
> 5. Now, I combined the above highlighting method with creating all my pages
> from a single DWT, and I had a few surprises.
>
> To give each <body> an ID (e.g., <body id="about">) I have to update each
> page created from the DWT. So far so good. However, if I have to update the
> appearance of the DWT itself, then it goes and updates all the pages attached
> to it, which is good; but it also returns all other HTML code to the DWT
> default, which in my above example means that since my DWT body is <body
> id="mastbody"> then that's what all the pages are also returned to, which is
> not good.
>
> In addition, the highlighting definition CSS code got broken apart by the
> DWT, splitting it up into separate, sometimes illegal, clauses in the CSS
> file.
>
> So, my question is, is there any way I can protect the HTML code (of my DWT
> attached file) from being updated?
>
> If not, can somebody please write me the line or two of JScript needed to
> highlight my buttons?
>
> tia
>