1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

在PHP里如何执行JS?

本帖由 BoBo2006-03-27 发布。版面名称:前端开发

  1. BoBo

    BoBo New Member

    注册:
    2005-09-29
    帖子:
    929
    赞:
    0
    当用户打开网站时(PHP做的)时就执行这段代码,怎么实现?

    代码:
    javascript:left.location.reload()
     
  2. Function

    Function New Member

    注册:
    2006-03-24
    帖子:
    3,884
    赞:
    5
    HTML:
    window.onload = "left.location.reload();"
    或者

    HTML:
    <body onload="left.location.reload();">
     
  3. BoBo

    BoBo New Member

    注册:
    2005-09-29
    帖子:
    929
    赞:
    0
    代码:
    		if($digest) {
    			foreach($creditspolicy['digest'] as $id => $addcredits) {
    				$forum['postcredits'][$id] = (isset($forum['postcredits'][$id]) ? $forum['postcredits'][$id] : 0) + $addcredits;
    			}
    		}
    在这段代码前加,怎么加?不要在BODY里,谢谢
     
  4. Tameway

    Tameway New Member

    注册:
    2005-09-06
    帖子:
    1,286
    赞:
    8
    onclick="left.location.reload()"

    调用JS是HTML中实现的,可以和PHP没有关系吧
     
  5. shu_yu

    shu_yu New Member

    注册:
    2006-03-19
    帖子:
    355
    赞:
    0
    :lol: