<!DOCTYPE html>
<html>
<head>
<script>
//if i put window.location= "index.php" here not inside js function it worked but I need it to be inside a function
function newLoad() {
window.location= "index.php"
}
</script>
</head>
<body>
<input type="button" value="press here" onclick="newLoad()">
</body>
</html>
任何想法如何让它在javascript函数中运行?
答案 0 :(得分:0)
您的代码有效。 Howether,你不需要使用javascript。
<a href="index.php">
<button>press here</button>
</a>