www.webdeveloper.com
Results 1 to 2 of 2

Thread: Dynamically assign links by ID

  1. #1
    Join Date
    Feb 2011
    Posts
    2

    Dynamically assign links by ID

    Ive been picking up javascript little by little after ignoring it for a while but as of recently ive been taking an interested in using it to improve my site.

    I noticed a lot of functionally with the getElementById line and was wondering if i can use this to set a destination to a link that exists on many pages .
    Sort of a link with the id contact and the javascript assigning an href value to everything with this id.

    Not sure if this was the right way to go about it though.

  2. #2
    Join Date
    Feb 2011
    Posts
    2
    Sweet nvm i figured it out. In case anyone was wondering, which i doubt since im a beginner anyway. it was

    inside a js file


    function pressLink()
    {
    document.getElementById('pressb').href="../press.html";

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles