私は関数を呼び出すために外部のjavascriptファイルを使用していますが、そうではありません。私はファイヤーバグでも定義されていない関数を取得します。"function not defined" in firebug
<script src="getpic.js" type="text/javascript">
</script>
PHP:
echo "<button id='sldkfj' onclick='hg();'>sdlkfj</button>";
JS:
function hg()
{
alert("hello")
}
外部JSファイルの 名前はgetpic.js HTMLでは、私はヘッダでこれを入れていますファイルシステムは基本的に1つのフォルダにあります。 これはgetpic.jsのすべてです
function hg()
{
alert("hello")
}
PHPの一部に
<html>
<head>
<script src="getpic.js" type="text/javascript">
</script>
</head>
<body>
<?php
echo "<button id='sldkfj' onclick='hg();'>sdlkfj</button>";
?>
EDIT ----- また、私は放火犯でこれを得続ける:
Reload the page to get source for: http://localhost/iframe/getpic.js
おかげ
hgが宣言されている場所を確認する必要があります –
getpic.jsのすべてを教えてください。 –
getpic.jsは実際にロードされていますか? –