开发者

Very small javascript is not running on php page

I have javascript working in similar pages, but for some reason this one page does not load the JS at all. It's not that the code isn't working (it's just a few lines), but on my code debugger (using chromes "inspect element" feature) the javacsript isn't even registered as a script.开发者_运维技巧 I suppose there is some issue in where I am placing it.

I have a header included at the top, then put the script immediately, as follows:

<? 
/* Include Files *********************/
require_once("common/header.php");
/*************************************/
?>

<script language="JavaScript" type="text/javascript">
    ClearSearch(){
        document.getElementById('search_q').value = '';
    }
</script>

Lower in the page, I have a button that calls this function onclick:

<input type="submit" name="submit_search" value="Show All" onclick="javascript:ClearSearch();">

When I click the button, not only is the text box not cleared, but the javascript doesn't seem to run at all. It's as if the script isn't being detected. Any ideas?


Missing function before your function declaration.

function ClearSearch(){
    document.getElementById('search_q').value = '';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜