我在使用php使用document.write显示flash嵌入对象时遇到问题。如果我将实际的html代码放在网站中,它会正确显示。它只是无法使用document.write与php一起工作。这是我的PHP代码。我认为这与我的报价有关,不确定。
header("content-type: application/x-javascript");
$javascript = "document.write(\"<embed id='FlashComponent'
src='http://domain.com/forums/mp3player/preview.swf?t=1333954601000'
bgColor = '#000000'
width='522'
height='300'
allowfullscreen='true'
allowScriptAccess='always'
flashVars='pathToFiles=http://domain.com/forums/&componentWidth=522&componentHeight=300&xmlPath=mp3player/xml/settings.xml&contentXMLPath=http://domain.com/forums/playerXML/1313.xml'></embed>\");";
echo $javascript;
输出:
document.write("<embed id='FlashComponent'
src='http://domain.com/forums/mp3player/preview.swf?t=1333954601000'
bgColor = '#000000'
width='522'
height='300'
allowfullscreen='true'
allowScriptAccess='always'
flashVars='pathToFiles=http://domain.com/forums/&componentWidth=522&componentHeight=300&xmlPath=mp3player/xml/settings.xml&contentXMLPath=http://domain.com/forums/playerXML/1313.xml'></embed>");