计数器[php]

来源:互联网 发布:js控制a标签跳转 编辑:程序博客网 时间:2024/04/27 18:40
想在网页上做个计数器 代码如下
<script language="iavascript">//计数器
  function get_hits($indexyj1.php){
        $hits="";
        if (file_exists($indexyj1.php)){
         $fp=fopen($indexyj1.php,"r");
         $hits=chop(fread($fp,filesize($indexyj1.php)));
         fclose($fp);
    }
    if($hits=="")$hits=0
    else
    $hits=(int)$hits;
    $hits++;
    if ($fp=fopen($indexyj1.php,"w")){
      fwrite($fp,$hits);
    
    }
    return $hits;
    document.write("<font color=#9B4E00 style='FONT-SIZE: 9pt'>"+$hits+"</font>");
    
</script>
在表格的显示代码为

</div></td>
                <td width="80"><div align="center"><span class="style2">欢迎您第</span> </div>
                <td width="91"><div align="center">
                    <script language="javascript">get_hits(indexyj1.php);</script>
                  </div>

预浏时,页面提示indexyj1未定义,功能无法实现~!
大家帮忙看看~!
谢谢~!
原创粉丝点击