javascript (hyperlink)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bekkem
    New Member
    • Nov 2007
    • 2

    javascript (hyperlink)

    how to give a hyperlink to view in the following code


    [CODE=javascript]<script language="javas cript" type="text/javascript">

    function addtoGrid(){
    alert("working" );

    var txt1=document.a wards.m_date_da teOfAchievement .value;

    var ta1=document.aw ards.m_str_awar dDetails.value;
    var ta2=document.aw ards.m_str_rema rks.value;

    var tbl = document.getEle mentById('tbl') ;
    var lastRow = tbl.rows.length ;

    var row = tbl.insertRow(l astRow);
    row.setAttribut e('onclick',fun ction(){
    alert("working" );
    document.awards .m_date_dateOfA chievement.valu e=txt1;
    document.awards .m_str_awardDet ails.value=ta1;
    document.awards .m_str_remarks. value=ta2;

    alert(this.rowI ndex);

    tbl.deleteRow(t his.rowIndex);} );

    var cellLeft1 = row.insertCell( 0);
    cellLeft1.inner HTML=txt1;
    var cellLeft2 = row.insertCell( 1);
    cellLeft2.inner HTML=ta1;
    var cellLeft3 = row.insertCell( 2);
    cellLeft3.inner HTML=ta2;
    var cellLeft4 = row.insertCell( 3);
    cellLeft4.inner HTML="view"; //how 2 provide the link here this a dynamically genereted table all the cells are filled in from the form controls except for view which is a fixed value displayed in every row.when we click on this it should go 2 a particular file where the data is.
    document.awards .m_date_dateOfA chievement.valu e="";
    document.awards .m_str_awardDet ails.value="";
    document.awards .m_str_remarks. value="";
    }

    </script>[/CODE]
    please give the code
    Last edited by gits; Dec 19 '07, 08:06 AM. Reason: added code tags
  • Freaky Chris
    New Member
    • Dec 2007
    • 24

    #2
    if i have understood what you are asking is it not just a case of adding the required html <a> tags to the string "view" and so you have
    [CODE=html]"<a href='http://www.thescripts. com'>view</a>"[/CODE]

    or does each one need a different url to load depending on which cell it is in?

    Chris

    Comment

    Working...