Pass <input type="image"> to var and then pass var to td(created dynamically)

The whole code goes :smile:

<!doctype>
<html>
<head>
 
 
 
</head>
 
<body  onload="CreateTable()">
<h1>My First Web Page</h1>
<script type="text/javascript">
function CreateTable()
{
var randomtext={ 
     // this immediately invokes a function 
     // which looks for the first anchor
     // and returns it's title attribute
     // that attribute is then assigned to the titleText property
     // on the object.
     titleText:(function () {
         var anchor = document.getElementsByClassName('css')[0];     
         return anchor.getAttribute('title');
     })(),
    title2: "name1",
    title3: "name3",
    title4: "name4",
}

    var tablecontents = "";
    tablecontents = "<table>";
	 tablecontents += "<tr>";
	  tablecontents += "<th>"+"Event Type"+ "</th>";
	  tablecontents += "<th>"+"CIS Status"+ "</th>";
	  tablecontents += "<th>"+"2SG Status"+ "</th>";
	  tablecontents += "<th>"+"Image"+ "</th>";
	   tablecontents += "</tr>";
    for (var i = 0; i < 5; i ++)
   {
  
      tablecontents += "<tr>";
	  
      tablecontents += "<td>" + i + "</td>";
      tablecontents += "<td>" + i * 2 + "</td>";
      tablecontents += "<td>" + i * 3 + "</td>";
	    tablecontents += "<td>" + link+ "</td>";
      tablecontents += "</tr>";
   }
   tablecontents += "</table>";
   document.write(tablecontents);
}
</script>
<a id="myLink" class="css" title="sometitle" href="#">Your HTML Here</a>
<input type="image"	id="img" src="./Director _ Simple Tables_files/edit.png"	onClick="editEvent();" style="width: 30px; height: 30px" />
</body>
</html>

output

Hello @Labhi_Gautam. Welcome to the forums.

I may be a bit dense but what is your question?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.