2012-04-27 61 views
-1

我可以在test.php的 Java脚本有错误

 // JAVASCRIPT VARS 
     // the path to the SWF file 
     var swfPath = "http://loveslgirls.com/Flash Mp3 Player/project/deploy/preview.swf"; 
     //swfPath += "?t=" + Date.parse(new Date()); // uncomment this line to activate cache buster   

     // stage dimensions 
     var stageW = 560;//560//"100%"; // minimum is 450 
     var stageH = 300;//400;//"100%"; // minimum is 260 


     // ATTRIBUTES 
     var attributes = {}; 
     attributes.id = 'FlashComponent'; 
     attributes.name = attributes.id; 

     // PARAMS 
     var params = {}; 
     params.bgcolor = "#333333"; 
     params.allowfullscreen = "true"; 
     params.allowScriptAccess = "always";    
     //params.wmode = "transparent"; 


     /* FLASH VARS */ 
     var flashvars = {}; 

     /// if commented/delete these lines, the component will take the stage dimensions defined 
     /// above in "JAVASCRIPT SECTIONS" section or those defined in the settings xml   
     flashvars.componentWidth = stageW; 
     flashvars.componentHeight = stageH;       

     /// path to the content folder(where the xml files, images or video are nested) 
     /// if you want to use absolute paths(like "http://domain.com/images/....") then leave it empty("") 
     // Also, if you want the embed code to work correctly you'll need to set the an absolute path for pathToFiles, like this: http://www.yourwebsite.dom/.../mp3gallery/ 
     flashvars.pathToFiles = "http://loveslgirls.com/Flash Mp3 Player/"; 
     flashvars.xmlPath = "project/deploy/mp3gallery/xml/settings.xml"; 
     flashvars.contentXMLPath = "project/deploy/mp3gallery/xml/mp3gallery.xml"; 

     /** EMBED THE SWF**/ 
     swfobject.embedSWF(swfPath, attributes.id, stageW, stageH, "9.0.124", "http://loveslgirls.com/Flash Mp3 Player/project/deploy/js/expressInstall.swf", flashvars, params, attributes); 

</script> 

    <table width="100%" height="100%" cellpadding="0" cellspacing="0"> 
     <td align="center"> 

      <!-- this div will be overwritten by SWF object -->  
      <div id="FlashComponent"> 
       <p>In order to view this object you need Flash Player 9+ support!</p> 
       <a href="http://www.adobe.com/go/getflashplayer"> 
        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/> 
       </a> 
      </div> 

     </td> 
    </table> 

上仅此代码执行JavaScript,但我添加此更复杂的PHP文件里面的不执行。它说Uncaught ReferenceError: ST is not defined Uncaught TypeError: Object [object DOMWindow] has no method 'addEvent'

如何将此播放器添加到我的复杂页面?

+1

的JavaScript!= Java的 – MByD 2012-04-27 11:41:36

+1

没有看到最复杂的页面一个不能真正帮助很好。但是好像有些代码试图访问在全局范围内不存在/声明的addEvent方法,所以我最好的办法就是查找代码并从那里查看。 – GillesC 2012-04-27 11:42:14

+0

当你在谈论你自己时,我不是我!编辑它。 – epascarello 2012-04-27 12:20:38

回答

0

看起来你是在调用脚本之前的元素在页面上。您正在调用的方法是否处理onload?如果不是,您应该在您引用的元素之后添加脚本,在document.ready上调用它,或者添加脚本onload。