繁体   English   中英

为什么我的加载 function 不工作?

[英]Why is my onload function not working?

这是位于 host_name 目录中的 web 应用程序的索引文件。

<?php

  include 'b2.php'; 

  session::start();

  if(session::is_active())
    {
    include 'b2e.htm';
    }
  else
    {
    include 'b1e.htm';
    }
?>

我打电话

public static function reload()
    {
    $uri = 'http://';
    $uri .= $_SERVER['HTTP_HOST'];
    header('Location: '.$uri.'/host_name');
    }

在使用登录后重新加载页面 b2e.htm。

这行得通。

但是,在 my.js 文件中没有调用 onload 函数 - 这里。 b2e.htm 和 b1e.htm 中都只包含一个.js 文件。

window.onload=n;
function n()
  {
  var a;
  if(a=document.getElementById('f0d'))
    {
    a.onclick=i0;
    document.getElementById('f1e').onclick=i1;
    }
  else
    {
    document.getElementById('f2a').onclick=i2;
    document.body.style.backgroundColor="#eeeeee"; 
    }
  }

基本上 else 中的语句应该执行,但不是。

header() 调用不会启动加载 function。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM