Results 1 to 2 of 2

Thread: anchor link not working in javascript

  1. #1
    Join Date
    Aug 2013
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default anchor link not working in javascript

    i want to embed a clickable anchor links in the code below.
    eg.

    '<a href="users.html?id=' + user.id + '"></a>'

    how do i achieve this in the line of code below

    +"<td>"+user.id+"</td>"


    Code:
    <script type="text/javascript">
    
    
    var newRow =
    "<tr>"
    +"<td>"+user.id+"</td>"
    +"<td>"+user.topic+"</td>"
    +"<td>"+user.view+"</td>"
    +"<td>"+user.reply+"</td>"
    +"<td>"+user.datetime+"</td>"
    +"</tr>" ;
    >

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    An anchor link (whether created by javascript or hard coded into HTML) must be to a named anchor (whether created by javascript or hard coded into HTML). For example with an anchor link like:

    Code:
    <a href="somepage.htm#topic12">Topic 12</a>
    That would take you to somepage.htm and once there look for:

    Code:
    <a name="topic12"></a>
    If it finds that, it will scroll that named anchor to the top of the window or as close to the top of the window as it can get if that named anchor isn't already at the top of the window or as close to the top of the window as it can get.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 2
    Last Post: 10-11-2010, 05:26 AM
  2. HTML anchor link?
    By Jaxbuild in forum HTML
    Replies: 2
    Last Post: 02-13-2009, 10:40 AM
  3. Link to an anchor in an iFrame
    By motiondude in forum HTML
    Replies: 2
    Last Post: 04-14-2008, 10:31 AM
  4. anchor link in javascript code
    By jianxin9 in forum JavaScript
    Replies: 4
    Last Post: 07-12-2007, 01:35 PM
  5. Working anchor in xml
    By boxxertrumps in forum Other
    Replies: 2
    Last Post: 10-26-2006, 05:55 AM

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
  •