外部javascript不起作用

| No TrackBacks | Previous

  加载了外部 javascript 不起作用,把js代码写到html里面却好使。这样修改一下就正常了。

Html内容:

<html>
<head>
  <script type="text/javascript" src="my.js"></script>
  <title>外部 javascript </title>
</head>
<body 

Js内容:

// JavaScript Document
getText();
function getText()
{
  var textString="";
    textString+='<div id="header-inner">';
    textString+=  '<div id="header-content">';
    textString+=    '<div id="header-name">';
    textString+=      '<a href="http://www.sothink.cn/" accesskey="1">SOTHINK</a>';
    textString+=      '</div>';
    textString+=    '<div id="header-description"></div>';
    textString+=  '</div>';
    textString+='</div>';
    document.getElementById("SOTHINK").innerHTML=textString;
}

  之前把JS放到外部不起作用,就是因为<body>里面没有加 onLoad="getText()" 这句话,浪费了我整整一天的时间。 - -||

本文结束。

No TrackBacks

TrackBack URL: http://www.sothink.cn/cgi-bin/mt-tb.fpl/27

About this Entry

This page contains a single entry by SOTHINK published on May 9, 2009 12:30 PM.

Archive::Tar On Movable Type was the previous entry in this blog.

Windows Media Player 已停止工作 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.