Calling a Script.aculo.us call from another page...

Discussion in 'Web Design and Development' started by 7on, Sep 11, 2008.

  1. 7on macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #1
    I'm using the "Effect.BlindDown('id'); return false;" on a page and it's working great. onClick and everything shows once it's clicked (the div is "display:none").

    The question is, "How do I get the Effect to enable from a link from another page."

    I have a button on the home page that when the visitor clicks it and takes them to this page I want the hidden content visible. Any other time I want it to be hidden when the visitor pops up. Is there anything I can add to the button's (it's an image) <a> tag that will call a javascript call from the address bar?

    Something like <a href="www.website.com/jobs.html?javascript:Effect.BlindDown('id'); return false;">

    That doesn't work as I've tried it, but is there a way to get what I'm asking for? Thanks!
     
  2. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #2
    I think I almost got it...

    I'm making the link be www.website.com/jobs.html#jobs

    and on the jobs.html page I put

    Code:
    <script type="text/javascript">
    if ((location.hash.substring(1)) = ('jobs'))
    Effect.BlindDown('id'); return false;
    </script>
    Still working with the semantics... don't think I have it written correctly...
     
  3. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #3
    From what I've read, this code should be working...
    but it's not. Could someone help me with it? Thanks!

    Code:
    <script type="text/javascript">
    if (window.location.hash.substring(1)=="jobs"){
    Effect.BlindDown('id');
    }
    </script>
     
  4. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #4
    I got it to work,

    Code:
    <script type="text/javascript">
    if (window.location.hash.substring(1) == "jobs"){
    window.onload = function () {
    	new Effect.BlindDown('id');
    }}
    
    </script>
    The big issue I was dealing with is the ASP guys down stairs have a <body onLoad="bodyOnload();">... removing that made my code work... but I don't know how get the two to co-exist... hmmmmm


    EDIT:Looked up onLoad="bodyOnload();" and it doesn't actually do anything because the () are empty. I just went ahead and deleted it.
     
  5. 7on thread starter macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #5
    The effect is out live if anyone wants to see it.

    http://www.favoritestaffing.com/
    Click on the "banner/button" below the tables to see the effect and just click on the "jobs" button to see how it differs.

    Sidenote: If there are any critiques that'd be nice. I don't think I'd be able to do anything as this site is firmly in the hands of the managers and VPs (I'm basically a Photoshop/Code monkey :( )
     

Share This Page