www.webdeveloper.com
Results 1 to 3 of 3

Thread: Link in JavaScript?

  1. #1
    Join Date
    Jan 2012
    Location
    Dallas
    Posts
    7

    Talking Link in JavaScript?

    I am a beginner and was wondering if it was possible to load a link (similar to HTML)? I know you can do

    location.href="url"

    But I was curious if I can set up a click through link?

    Thank you!

  2. #2
    Join Date
    Nov 2007
    Posts
    409
    What do you mean by "click through link"? Can you give a Use Case for what you want to happen?

    User clicks a link to a page and your page uses javascript to take the user to a different page?

  3. #3
    Join Date
    Jun 2010
    Posts
    64
    If you mean is it possible to simulate a user clicking on a link, the answer is yes.

    You'd use this (not sure why you'd want to though!):
    Code:
    <a href="http://example.com"></a>
    
    <script>
    	var link = window.document.getElementsByTagName("a")[0];
    	links.click();
    </script>

Thread Information

Users Browsing this Thread

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

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