简体   繁体   English

为什么Firebug无法检测到某些JavaScript?

[英]Why is Firebug unable to detect some JavaScript?

I have written JavaScript outside the <body> end tag. 我在<body>结束标记之外编写了JavaScript。 Firebug is unable to detect the JavaScript and I am unable to detect the JavaScript error. Firebug无法检测到JavaScript,而我也无法检测到JavaScript错误。

Here is my code: 这是我的代码:

</body>
<script type="text/javascript">

function displayIFrameContent()
{   
    var iFrame = document.getElementById("link");
    var if1= "<iframe src='http://leadmarket.hol.es/forms/solar-power.php?adv_id=" + <?php echo($fetch_users_data['id']); ?>; 
    var if2= "<iframe src='http://leadmarket.hol.es/forms/kitchen-installation.php?adv_id=" + <?php echo($fetch_users_data['id']); ?>; 
    var if3= "<iframe src='http://leadmarket.hol.es/forms/conservatory.php?adv_id=" + <?php echo($fetch_users_data['id']);; ?>; 

    var host = document.getElementById("host");
    var subId = document.getElementById("subid");
    var errorClass = "box form-validation-error border-width-2";

    if(host.value == "")
        changeClass("host", errorClass);

    if(host.value != "")
    {       
        var iFrameEnd = " width='280' height='330' frameborder='0' scrolling='no'></iframe>";

        var leadTypeSelect = document.getElementById("leadType");
        var leadTypeValue = leadTypeSelect.options[leadTypeSelect.selectedIndex].value;

        iFrame.value  = "";

        if(leadTypeValue == 1)
            iFrame.value  = if1 + "&" + "sub_id=" + subId.value + "&source=" + host.value + "'" + iFrameEnd;

        if(leadTypeValue == 2)
            iFrame.value  = if2 + "&" + "sub_id=" + subId.value + "&source=" + host.value + "'" + iFrameEnd;

        if(leadTypeValue == 3)
            iFrame.value  = if3 + "&" + "sub_id=" + subId.value + "&source=" + host.value + "'" + iFrameEnd;
    }       
}


function changeClass(id, classname) 
{
    document.getElementById(id).setAttribute("class", classname);
}   
</script>
</html>

Your help will be appreciated. 您的帮助将不胜感激。 Thanks in advance! 提前致谢!

The code above contains PHP tags, which cause some syntax errors. 上面的代码包含PHP标记,这会导致一些语法错误。 In this case the Script panel just shows a message "No Javascript on this page". 在这种情况下,“脚本”面板仅显示一条消息“此页面上没有Java脚本”。 You should make sure they are interpreted by PHP before they are output to the browser. 在将它们输出到浏览器之前,应确保它们已被PHP解释。

Also JavaScript syntax errors are listed within the Console Panel . 控制台面板中还会列出JavaScript语法错误。 Make sure you have the option Show JavaScript Errors checked to see them. 确保选中“ 显示JavaScript错误 ”选项以查看它们。

Furthermore there's a detailed description about script debugging available within the Firebug wiki. 此外,Firebug Wiki中提供了有关脚本调试的详细说明

Sebastian 塞巴斯蒂安

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM