2016-09-23 4 views
0
<!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関数内で動作させることができますか?window.locationがjs関数内で動作しない

+3

_not working_ !!を定義します。 –

+0

はindex.phpに直接指定していません –

+0

コードが実行されるはずなので、何が違うのですか? – epascarello

答えて

0

コードは機能します。あなたはJavaScriptを使う必要はありません。

<a href="index.php"> 
    <button>press here</button> 
</a> 
関連する問題