Add the ability to go to another HTML page in dynamic table made using javascript -


I am writing a web page that has a table with a button in the table that goes to the information page Clicking on the button takes you to the information page. The table is also dynamic, as you wish, add and remove rows. Buttons will go to all the same information page because the information on the page will be filled using the websites that can be used in other programs. I can dynamically add buttons and rows to the table in JavaScript, but the dynamically added buttons have the onclick attribute to go to the info page when I click on the notification button I do not, then nothing happens. Click here to add the dynamically button and click on the button when the information is known on the page

  var cell6 = row.insertCell (5); Var element5 = document.createElement ("button"); Element5.type = "Button"; Element5.name = "button []"; Cell6.appendChild (element5); Element5.innerHTML = "Information"; Cell6.style.textAlign = "center"; Element5.onclick = "onClick = location.href = 'foo.html'";  

is the last line, where I am trying to set the onclick attribute, does anyone know how to correctly address this?

<

You need to pass a function Will act as handler

  element5.onclick = function () {location.href = 'foo.html'; }  

Comments

Popular posts from this blog

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

c# - Process.Kill() returns access denied -

c# - Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments -