XML不能是整个程序 [英] XML can't be the whole program

查看:50
本文介绍了XML不能是整个程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我包含以下js文件(其中包含jquery)时,我在Firebug中收到错误XML不能是整个程序

When I include the following js file (with jquery in it), I get the error in Firebug "XML can't be the whole program"

JS文件包括引用:

<script src="~/Scripts/scriptname.js" type="text/javascript"></script>

JS文件内容:

$("[id*='txtAddress1S']")
  .blur(function(){
   $("[id*='txtAddress1S']")
      .val().match(
          /\b[p]*(ost)*\.*\s*[o|0]*(ffice)*\.*\s*b[o|0]x\b/i)&&
         (alert("Packages are not deliverable to a Post Office Box.
         \nPlease provide a different shipping address."),
    $("[id*='txtAddress1S']").focus())
  });

提前致谢!

推荐答案

使用可能无法正确理解您的脚本 src 属性被解析为空的< script> 标签。使用javascript文件的完整路径,或相对于其加载的页面的路径:

It might be that your script src attribute is not properly understood with the ~ and being parsed as an empty <script> tag instead. Use the full path to the javascript file, or a path relative to the page it's loading on:

<script src="/full/path/to/Scripts/scriptname.js" type="text/javascript"></script>
<script src="../relative/to/Scripts/scriptname.js" type="text/javascript"></script>

这篇关于XML不能是整个程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆