SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hyperlink reference to a CSS layer

    I have a page with layers that show different content. I f I have a hyperlink from another page, how do I reference the layer I want the user to see?

    Is it <a href="page.asp#layername"> ??

    *I searched and couldn't find the answer*

    TIA

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code samples please. If you have several layers but want only some to show, how are you handling that? With display:none? More details please.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don;t have any code samples as I am asking this for a colleague, but ...

    Let's say I have a page (main.asp) with two layers..

    <div id="Layer1"></div>

    and

    <div id="Layer2"></div>

    One layer is hidden while the other (there will be more than 10) will be invisible.

    WHen linking to this page from another page (other.asp) using a hyperlink...how do you reference the layer?


    <a href="main.asp#layer1"></a> ????

    Is this possible? or is there more involved. I thought this was a cut and dry question, but apparently it seems it isn't. Any suggestions?

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see. Well, typically the hash (#) is reserved for named anchors, but if you don't have any named anchors on the page, you can use it. Otherwise, I'd probably recommend a search string instead.

    <a href="main.asp?layer1"></a>

    Then some Javascript code to get the query
    Code:
    var showLayer = top.location.href.substring('?'+1);
    - OR - (for IE DOM)
    var showLayer = top.location.href.search;
    Now, since you are using an ASP page, you could use GET variables to make it easier. I don't know ASP, so I'll show you what I'm thinking of in PHP. $ designates a variable in PHP, so here we go. Suppose our link looks like this: <a href="main.asp?show=layer1></a> (or <a href="main.php?show=layer1></a> for my example)
    PHP Code:
    <?php

    $showLayer 
    $_GET['show'];

    ?>

    <script langauge="javascript'>

    var showLayer = "<? echo $showLayer ?>";

    // Code to handle layer visibilty toggling

    </script>
    Hope this helps
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see..I can do that with ASP. I just thought that there was an easier way of referencing a CSS layer..

    Thanks Beetle!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •