create hyperlink into innerHTML

Discussion in 'JavaScript' started by albert85, Apr 16, 2006.

  1. #1
    i create a function to increase the row of the table everytime i called. the function is like this:
    function insRow(wp,ln,item_no,item_desc,quantity,vo_no,vo_typ){
    var x=document.getElementById('wp_tbl').insertRow(1);
    var col1=x.insertCell(0)
    var col2=x.insertCell(1)
    var col3=x.insertCell(2)
    var col4=x.insertCell(3)
    var col5=x.insertCell(4)
    var col6=x.insertCell(5)
    var col7=x.insertCell(6)
    col1.innerHTML=wp
    col2.innerHTML=ln
    col3.innerHTML=item_no
    col4.innerHTML=item_desc
    col5.innerHTML=quantity
    col6.innerHTML=vo_no
    col7.innerHTML=vo_typ
    }

    what i want is put in the hyperlink in the col1 and col2 and past the value to the next page. how i going to do that???
     
    albert85, Apr 16, 2006 IP
  2. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What do you mean by "past the value to the next page"? And, why don't you explain in more detail what you want to accomplish. The code you have there looks a bit painful, and might not be the best way to do what you want to do.
     
    exam, Apr 16, 2006 IP
  3. albert85

    albert85 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    actually that function will add the row everytime i call it. i have a bunch of record need to display inside table so i create the insRow function to pass in the parameter to add into table but my problem is i want to add in hyperlink into the 2 column but my table is create by the javascript insRow function so i don't know how to put in the hyperlink. can anyone teach me
     
    albert85, Apr 16, 2006 IP
  4. BurgerKing

    BurgerKing Active Member

    Messages:
    397
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Hi,

    seems like you would be able to do something like this:

    col2.innerHTML='<a href='page2.html?' + params + '>Page 2</a>';

    This will add a hyperlink into column 2, with the anchor text of 'Page 2'.

    The params variable is just something I made up as you don't specify what parameters you want passed to the next page.
     
    BurgerKing, Apr 23, 2006 IP