经常使用Vue来开发前端,使得自己竟然忘记了原生的JS一些常用操作功能。例如最近在做一个网页时,动态添加input过后,想在页面添加一个能刷新页面的功能,因为js动态添加input,如果再一次按动态添加input时,需要对前一次添加的做出判断,如果存在新添加的节点,则删除后然后再加了。想来想去,最简单的方法是重新刷新一下页面。
点击button刷新的几种常用代码
1、<input type=button value=刷新 οnclick="history.go(0)">
2、<input type=button value=刷新 οnclick="location.reload()">
3、<input type=button value=刷新 οnclick="location=location">
4、<input type=button value=刷新 οnclick="location.assign(location)">
5、<input type=button value=刷新 οnclick="document.execcommand(refresh)">
6、<input type=button value=刷新 οnclick="window.navigate(location)">
7、<input type=button value=刷新 οnclick="location.replace(location)">
8、<input type=button value=刷新 οnclick="window.open(自身的文件,_self)">
9、<input type=button value=刷新 οnclick=document.all.webbrowser.execwb(22,1)>