首页javascripttableJavascript Element - 如何单击p元素更改标题...

Javascript Element - 如何单击p元素更改标题...

我们想知道如何单击p元素更改标题。...

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){
    var table, inputs, arr;
    table = document.getElementById( 'test' );
    inputs = table.querySelectorAll( 'input' );
    arr = [].slice.call( inputs ).map(function ( node ) {
        return node.id; 
    });
    console.log( arr );
}
</script>
</head>
<body>
  <table id="test">
    <tr>
      <td><input id="foo"></td>
      <td><input id="bar"></td>
      <td><input id="baz"></td>
    </tr>
  </table>
</body>
</html>