Share links

Discussion in 'JavaScript' started by gvm, Sep 19, 2006.

  1. #1
    Can anyone point me in the right direction? I would like to share the same hypertext link across web pages from a .js file so if I make changes I only need to do it in the .js file. The link needs to display in the same column across the pages...I'm thinking maybe refernce a div id?

    Thanks for any suggestions.
     
    gvm, Sep 19, 2006 IP
  2. gvm

    gvm Guest

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is how I got it to work.

    I created the container: moreLinks.js with this function: function Links(href){

    this.href = ('<a href="moreLinks.html">More links</a>');

    }

    Placed this in the head on my .html page:<script src="scripts/moreLinks.js" type="text/javascript"></script>
    </head>

    In the body where I wanted the hyperlink text to show I inserted:
    <script language="javascript" >
    Links(this.href);
    document.write(this.href);
    </script>

    The CSS style took care of the rest.
     
    gvm, Sep 19, 2006 IP