Detect the current page using JS

Hi all, I would have figured this out myself, but I am stumped on this... why it doesn't work?

< script type = "text/javascript" >
document. Write ("< ul >");
document. Write ("< li > < a href = 'index.html'" + if (window.location.href.match ("index.html")) {document.write ("class ="x"") ;}} ") + "> link < /a > < /li >");
document. Write ("< li > < a href = 'links.htm' > link < /a > < /li >");
document. Write ("< li > < a href ="contact.htm"> link < /a > < /li >");
document. Write ("< /ul >");
< /script >

I decided to just go with PHP. Would be really nice to know why it doesn't work well... If anyone knows, please email me: mike (at) cssdreams (dot) com

* Date limit thread *.

Tags: Dreamweaver

Similar Questions

  • How to detect the current page

    How can I undergo certain cfif conditions to detect the current page?

    < cfif? Page1.cfm IS > abc
    < cfelseif? Page2.cfm IS > def
    < cfelseif? Page3.cfm IS > IAD
    < cfelse > jkl
    < / cfif >

    Use the cgi variables...
    Try using to see who is available.
    GL, Mike

  • Using the current Page number in IF Condition

    Hello

    I have a requirement to insert a blank page if the last page in the group number is odd, then I'll try to use the syntax below, but its does not work:

    <? If: page-mod number 2! = 0 ? >

    < xsl: attribute name = "break-after" > page < / xsl: attribute >

    <? end if? >

    The number of pages in my report is 5 and if I put 5 instead of the page number in the code above, the blank page is inserted, but it seems that this page number is not acknowledged in the IF condition, and if I put <? fo:page - number? > instead of page number in the if condition, I get an error.

    How can I write an if condition based on the current page number?

    Thank you

    Patrick

    Try using the below command

    Have a condition before you group items

    -jump - number of pages F

    EmpNo

    Ename

    F EMPNO

    ENAME E

    E

    same-jump-number of pages---> contains


    When you want to manage the deletion of the pages of the total number of pages

    You can use the following command in the form same-jump-number of pages field-->

    Thank you

    If this allows you then, please check the answer "correct" or even "useful."

  • using the &amp; lt; body ID = to highlight the current page on the navigation bar

    Hi all, using the method of the body tag of the give an id to the value of the current on the navigation bar page, works very well. but it's not good if you are working from a model as it would mean the < body > being editable on every page (so most of the content then)... I'm wrong? or am I missing something here that will allow me to change the < body > blindingly obvious...

    Many thanks - didn't really want to use the javascript method you see!

    > Hi all, using the delivery mode of the body tag an id to set the current
    > page
    > on the navigation bar, works very well. However, this is not good if you are
    > working from a model because it would mean thebeing editable on each
    > page
    > (so most of the content then)... I'm wrong? or did I miss something
    > blinding here that will allow me to change the...

    Ideally, you would not actually link the item in the menu on the page that you are
    currently. It is one thing to usability and accessibility. If you do this, then
    You can simply the style of elements not linked in the menu differently to highlight
    This page.

    That said, it is often not a practical solution if you use SSIs to load
    the menu.

    In this case, you can simply add the class to a DIV wrapper, or menu
    itself:



    etc.

    OR, Alternatively, give each meny item it of own class and then work around
    only a special class in the HEAD of each page style. That
    said, I don't know how well it would work with DW models.

    -Darrel

  • How to detect the current .cfm.

    When the user is "index.cfm", how can I write a cfif tag to detect this?

    Basically I want my navigation menu to look different depending on the location of the user course I could simply change the CSS of the menu for each page, but I use cfinclude to place the menu around the site, so there is only 1 version of the menu.

    Thank you!

    Without knowing the bigger picture of your web app, here are some places/ways to determine the current page:

    If you use Application.cfc, the current page is passed as a parameter to the onRequestStart method. The setting is called "targetPage" by default (but I imagine you could change this) and it contains the path of the web root access to the page that is called. If the called page is www.mydomain.com/index.cfm, the value of this parameter would be "index.cfm".

    Example:

    You can also use CGI variables on any CML page in your application to get the name of the page. Many variables in the CGI scope, script_name is probably the best to use.

    Example:

    I hope that the above will get you started. Good luck and have fun!

  • I want the main tone of take me to the top of the current page, the end key to take me down.

    He was the original key took me to the top of the current page, the end key down. Recently it stopped doing this on the pages of some, not all, sometimes, behavior is used, then stops again. It seems that they take me at the beginning and at the end of the current line instead. "always use the cursor keys to navigate within pages" is always on.

    This seems to solve this - although it was variable. I don't know why I'd start inadvertently, the F7 key substitution - I'm not knocking the other F keys inadvertently. I misinterpreted always "use the cursor keys to navigate through the pages" to designate the behavior I wanted. Change of browsewithcaret turned it off.

  • How can I add reload the current Page in the toolbar Firefox 9?

    Once I have use customize toolbar, reload the current Page is not an option. I got this feature in previous versions of Firefox, and on another computer where Firefox has been updated to 9 the rest feature but I can't understand how to add to this new computer.

    Firefox 4 and later versions use a combined Stop/Reload/Go button that is placed at the right end of the address bar.

    During the process of loading page it shows as a stop button and once the charging button is replaced by a reload button.

    If you type in the address bar this button would then become a button go.

    Click the Reload button to duplicate the current tab in a new tab.

  • I can not open a new tab anyway... by clicking on the button new tab bar tabs, or ctrl/T or file/new tab, or by clicking on the link on the current page.

    On Windows7 Home Premium Edition, I can't get a new tab to open no matter what I try. Occasionally, if I click on a link on the current page, a second tab opens, but 99% of the time I'm stuck using the first tab for everything and using the back button. I tried ctrl/T, tab file/new, right mouse click / New tab and the new button tab in the tab to the right of the current tab bar.

    Uninstall the Ask Toolbar. It can cause this problem.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • When I open a new tab, I stay on the current page, even though I have changed my preferences to focus on the new tab.

    When I open a new tab, I stay on the current page, even though I have changed my preferences to focus on the new tab.

    You have this problem when running in Firefox SafeMode?
    http://support.Mozilla.com/en-us/KB/safe+mode
    Do not choose anything at the moment, just use 'continue in safe mode.

    If this is not the case, see this:
    http://support.Mozilla.com/en-us/KB/troubleshooting+extensions+and+theme...

    You probably have an installed extension that has a conflict with another extension.

  • New windows in Firefox 3.6.3 ctrl-N to go to the home page. How to start on the current page?

    Prior to my upgrade to Firefox 3.6.3, there is an extension (addin) which allowed the new Windows Ctrl-N, and they began to the current page. The extension is not valid after the upgrade, it seems that 3.6.3 has an ability to Ctrl-N, but new pages begin now, always, to the "start" page

    New page 3.6.3' s is configurable from the current page feature?
    Thank you

    This has happened

    Each time Firefox opened

    Is with my upgrade online to version 3.6.3

    I use this extension to load the current page in a new window.
    Clone of extension of the window - will also Clone a tab:
    http://www.Pikey.me.UK/Mozilla/?addon=CW

  • J4580: J4580 will not detect the alignment page.

    My J4580 that works very well for years, now will not detect the alignment page after you print and put on the scanner bed.  I try three times and it then goes to the default alignment parameters.  It still prints but text tends to little fuzzy.  What can I do to fix this?

    Hi @BruceK43,

    Thanks for joining the Forums of HP Support for a solution to your problem of alignment.

    I understand that you used a HP Officejet J4580 all-in-One printer with a Windows 10 computer but when you try to only scan the alignment page, the printer is not detected by the alignment page returns to the default alignment parameters. I would like to help with that.

    Here is the document of support designed to be used with this problem - a "alignment failed" Error Message appears on the printer control panel.

    Please let me know if that solves the problem, or if you need assistance.
  • stay on the current page. When the user presses ESCAP.

    int

    if (type1 is Dialog.OK)

    {

    intask (Dialog.D_YES_NO, "Please confirm");

        if (type is Dialog.YES)

    {

    perform your task if yes

    ClearAll();

    Login_Screen.disconnect ();

    UiApplication.getUiApplication () .pushScreen (new L_Screen());

    }

    }

    if (type1 is Dialog.CANCEL)

    {

    What should the code because I want to stay on the page current user //press whe cancel but

    }

    Type1 = Dialog.ask (Dialog.D_OK_CANCEL, "Do you want to disconnect now?");

    Hello friends,

    I do the page to disconnect. I want to give confurmation beform logout. Everthing is working. but

    Aler dialogue ask first you want to disconnect or not?

    If he says cancle I want to stay on the current page. but still he go on the back. When your press esce I check everything.

    Please tell me what is the code to stay on the current page when the user press cancle alser dialogue?

    That's what I understood.

    I don't think you understood what I was saying. so here's an example of code:

        protected boolean keyChar(char character, int status, int time) {
            switch (character) {
                case Characters.ESCAPE:
                    confirmClose();
                    return true;
                default:
                    return super.keyChar(character, status, time);
            }
    
        }
    
        private void confirmClose() {
            int resp = Dialog.ask(Dialog.D_YES_NO,"Do you really want to Quit",Dialog.NO);
            if ( resp == Dialog.YES ) {
                resp = Dialog.ask(Dialog.D_YES_NO,"Do you really, really want to Quit",Dialog.YES);
                if ( resp == Dialog.YES ) {
                    // Close the screen as you currently do it
                }
            }
        }
    

    If you don't mind asking me, please use English. for example, the letter "y" is, is not the question why.  I recommend this spell check you your messages also, don't forget that a lot of people who use these forums are not native English speakers, so we use English must be as clear as possible.

  • Enkitec Toolbar... Stop the menu items of the current page of derivative

    XE Summit 4.2 11.2

    Hi all.  Question today: I am using the Enkitec toolbar in my application. and everything works fine... except...

    Ive changed the application so the I have a series of reports that point to the same page to run a number of interactive reports with different settings...   They are grouped into a number of items in the submenu.

    However, the Enkitec menu is highlighting the current page. Like all items in menu 4 are all active page (or URL active), he sets them all to the same color blue., so instead of a list of menu with all the white background, I get a menu list when they are all blue...

    So Im trying to either disable the 'select the menu for the active page item' (easier) or somehow allow him to recognize that its actually a variant of the same page... (the settings are different...)

    Ive tried overiding the CSS with what I think is correct according to the how to on the web site Enkitec, but without success...

    If anyone could offer advice, Id be grateful...

    Kind regards

    Richard

    Hi Richard,

    Are you sure that's not because of the condition of the sub components?

    I'm sure you check 'in progress' through the list.

    Thank you

    -Jorge

  • How to clear a single block of the current page in the OPS

    Hi all

    How to erase a single block of the current page in the OPS. I used the CLEAR key.


    Thank you

    Hello

    I found the solution I wrote it in the button DELETE. I wrote the remove with vo1.setMaxFetchSize method (1);

    and remove called AOS

    Thank you

  • The previous/next Page number is showing that the current page number

    I'm trying pages numbers with previous Page number and the current Page number, then it is and shows that reason 002-003, but for some they are both appearing as the number of courses, so 003-003. The same thing happens if I try to insert the next Page number.

    I have this set up in the master page in a document issued in March and it works great - when I add new pages they are automatically numbered correctly. However, in a new document, or if I add a new text box to my old document, the Page number previous shows that the current Page number.

    Any idea of what is the cause? I use the latest InDesign on a Mac with os x 10.11.12. My colleague is having the same problem on his Windows PC.

    I am waiting to start a conversation with Technical Support, so I'll post the results.

    Hey Willi

    Thanks for your reply, we are both halfway there, it isn't fair for the lines break...

    I just checked my old document and there was a block of empty text hidden under something else on the previous page, which is linked to the image on the next page that holds page numbers. I need to insert a Page break at the beginning of the first text box to force the numbers on the following page. Now my second text box displays the previous and current page numbers.

    Problem solved!

Maybe you are looking for

  • Firefox is frozen and does not close but I want to uninstall it. Help!

    Firefox has been opened and an error message. Script is not running, continue, or stop the script? All the options have been frozen I wasn't able and still not be able to close firefox or tabs from it, has been frozen for two days. Y at - it a comman

  • Standard VGA graphics card

    I HP G72 - B10EM XF084EA, 17.3 '', Core i3, 500 GB HDD, 4 GB RAM, Linux. But I installed windows 7 instead of linux on it. After that I installed windows 7 I noticed that the resolution is not as good as it should be, so I tried to change it. Then I

  • Cleaning screen cover

    Hi, what is the best way to clean the rubberized screencover? I had traces of fat on the sides fingers when you open the laptop.

  • Establishment of a network connection when you receive a wireless signal

    How to configure network (as a router) connection while receiving a wireless signal

  • Remove ask toolbar

    I can't get uninstall to remove the ask toolbar - it starts to uninstall & then a window will appear indicating that the chrome browser must be closed.  Make sure that everything is closed and this window just comes up constantly on & on & it will no