下面是我的代码,它不起作用.将"click()"重命名为"click1()"后,它有效,为什么?
<html>
<head>
<title></title>
<script type="text/javascript">
function click() {
document.getElementById("content").innerHTML = "abc";
}
</script>
</head>
<body>
<button onclick="click()">try it</button><br />
<div id="content"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 为什么每次按下按钮都会增加内存使用量,因为我已将指针设置为NULL?(附代码)
这使我的程序继续增加内存使用量.
谢谢.
package newHashFunction;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Memory_not_released extends JFrame{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Memory_not_released memory_not_released=new Memory_not_released();
}
Memory_not_released(){
JButton button1=new JButton("create bytes");
button1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
byte[] byte1=new byte[10000000];
byte1=null;
}});
add(button1);
this.pack();
setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
Run Code Online (Sandbox Code Playgroud)