Javascript代码有时打印在屏幕上

Javascript代码有时打印在屏幕上,javascript,php,highslide,Javascript,Php,Highslide,我在我的网站上使用highslide库,有时并非所有时间,我使用的代码都打印在屏幕上,但我不知道为什么,这是我的代码: <script type="text/javascript"> hs3.graphicsDir = '<?echo $RootPath;?>/ExternalLibrary/highslide/graphics/'; hs3.align = 'center'; hs3.transitions = ['expand', 'crossfade'];

我在我的网站上使用highslide库,有时并非所有时间,我使用的代码都打印在屏幕上,但我不知道为什么,这是我的代码:

    <script type="text/javascript">

hs3.graphicsDir = '<?echo $RootPath;?>/ExternalLibrary/highslide/graphics/';
hs3.align = 'center';
hs3.transitions = ['expand', 'crossfade'];
hs3.fadeInOut = true;
hs3.outlineType = 'glossy-dark';
hs3.wrapperClassName = 'dark';
hs3.captionEval = 'this.a.title';
hs3.numberPosition = 'caption';
hs3.useBox = true;
hs3.width = 600;
hs3.height = 400;

hs3.addSlideshow({
    //slideshowGroup: 'group1',
    interval: 5000,
    repeat: false,
    useControls: true,
    fixedControls: 'fit',
    overlayOptions: {
        position: 'bottom center',
        opacity: 0.75,
        hideOnMouseOut: true
    },
    thumbstrip: {
        position: 'above',
        mode: 'horizontal',
        relativeTo: 'expander'
    }
});

var miniGalleryOptions1 = {
    thumbnailId: 'thumb1'
}
</script>

hs3.graphicsDir='/ExternalLibrary/highslide/graphics/';
hs3.align=‘中心’;
hs3.transitions=['expand','crossfade'];
hs3.fadeInOut=真;
hs3.outlineType=‘光泽暗’;
hs3.wrapperClassName='dark';
hs3.captionEval='this.a.title';
hs3.numberPosition='caption';
hs3.useBox=true;
hs3.1宽度=600;
hs3.1高度=400;
hs3.addSlideshow({
//幻灯片组:“组1”,
间隔时间:5000,
重复:错,
对,,
fixedControls:'fit',
覆盖选项:{
位置:'底部中心',
不透明度:0.75,
藏身处:对
},
指带:{
位置:'上方',
模式:“水平”,
相对论:“扩展器”
}
});
var miniGalleryOptions1={
thumbnailId:“thumb1”
}

其中$RootPath是php变量,其值是Portal。屏幕上打印的代码是$RootPath变量后面的代码,有什么想法吗?

$RootPath包含一些注入,而不是值“门户”-什么!?!?请容忍我


包含“”或类似内容;如果您是用户,请查看实际呈现的HTML。这反过来会导致浏览器关闭script元素,从而导致以下内容被视为正常处理,而不是在script HTML中处理。(如果遇到序列,浏览器可以从技术上终止脚本元素的PCDATA“好的,这是真的,我的朋友,php变量后面有一个结束符,但为什么?我不明白为什么会发生这种情况,为什么$RootPath包含或类似的视图?请您解释一下好吗。@Omartha我不知道该值从何而来;这是供您查找的:)这可能是一个意外赋值。。或者有人试图插入恶意值。在代码中追溯到它被分配有问题的值的位置/原因。好吧,我尝试使用你的代码,但仍然出现。不可能(好吧,这可能是可能的,但在我接受这个想法之前,我希望看到实际生成的HTML)-发布相关
hs3.graphicsDir=…
line.document.location的实际HTML="> ;hs3.align=‘中心’;hs3.transitions=['expand','crossfade'];hs3.fadeInOut=真;hs3.outlineType=‘光泽暗’;hs3.wrapperClassName='dark';hs3.captionEval='this.a.title';hs3.numberPosition='caption';hs3.useBox=true;hs3.1宽度=600;hs3.1高度=400//hs.调光能力=0.8;这正是html中的内容
hs3.graphicsDir = <?echo json_encode("$RootPath/ExternalLibrary/highslide/graphics/"); ?>;