我网站编程基本不大会。
现在用dreamweaver编了一个网站的架构 然后想把之前编的javascript程序添加进去, 但是再打开网页的时候就不能运行那个javascript了。 单独的时候是可以运行的。 请大神们帮忙给看看 谢谢了 下面是我的代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>F-Droid</title>
<link rel="stylesheet" href="2col_leftNav.css" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {font-size: xx-large}
-->
</style>
<SCRIPT>
var xmlDoc = new ActiveXObject("microsoft.xmldom")
xmlDoc.async=false
xmlDoc.load("fdroid.xml")
root=xmlDoc.documentElement
newHTML=""
function start(){
buildTree(root)
content.innerHTML=newHTML
}
function buildTree(passedNode){
var children = passedNode.childNodes.length
for (var j=0; j<children; j++){
Node=passedNode.childNodes.item(j)
if (Node.nodeName=="application"){ newHTML+=("<div class="story"><P>"+Node.nodeName+" "+j) }
if (!Node.hasChildNodes()){
if(Node.parentNode.nodeName == "name"){
newHTML+=( "<BR><B>"+Node.parentNode.nodeName+":</B> "+Node.text )}
else if (Node.parentNode.nodeName =="icon"){
newHTML+=("<BR><img src=\icons\" +Node.text +"></div>" )}
}
buildTree(Node)
}
}
window.onload = start;
</SCRIPT></head><BODY>
<!-- The structure of this file is exactly the same as 2col_rightNav.html;
     the only difference between the two is the stylesheet they use --><div id="masthead">
  <h1 id="siteName">F-Droid</h1>
</div>
<!-- end masthead -->
<div id="content">
  <h2 id="pageName">HomePage</h2>
  <div class="feature"> <img src="file:///C|/Users/lenovo/Documents/T-Droid/cropped-fdroidheader.jpg" alt="" width="331" height="112" />
    <h3>F-droid</h3>
    <p>. find the application you want!!! </p>
  </div>
  <div class="story"></div>
</div>
<!--end content -->
<div id="navBar">
  <div id="search">
    <form action="#">
      <label>search</label>
      <input name="searchFor" type="text" size="10" />
      <input name="goButton" type="submit" value="go" />
    </form>
  </div>
  <div id="sectionLinks">
    <ul>
      <li><a href="#" class="STYLE1">首页</a></li>
      <li><span class="STYLE1"><a href="#">热门</a></span></li>
      <li><span class="STYLE1"><a href="#">趋势</a></span></li>
    </ul>
  </div>
  <div class="relatedLinks">
    <h3>分类</h3>
    <ul>
      <li><a href="#">社交</a></li>
      <li><a href="#">工具</a></li>
      <li><a href="#">浏览</a></li>
      <li></li>
    </ul>
  </div>
</div>
<!--end navbar -->
<br />
</body>
</html>

解决方案 »

  1.   

    start 应该写成 start();吧
    我一般都这样写
    window.onload=function(){
    //这里的代码在页面一载入就运行。你可以把start()在在这里面,等同于你的window.onload=start
    start();
    }
      

  2.   

    LZ貌似以前没有编写过C风格语言吧,每一句后面都不带分号(;)哒?我是说语法,不少语言语句结束是不带分号的。。
      

  3.   

    if (Node.nodeName=="application"){ newHTML+=('<div class="story"><P>'+Node.nodeName+" "+j) }
    if (!Node.hasChildNodes()){
    if(Node.parentNode.nodeName == "name"){
    newHTML+=( "<BR><B>"+Node.parentNode.nodeName+":</B> "+Node.text )}
    else if (Node.parentNode.nodeName =="icon"){
    newHTML+=("<BR><img src='icons" +Node.text +"'></div>" )}引号嵌套问题