Javascript 使用document.write添加jQuery本地回退

Javascript 使用document.write添加jQuery本地回退,javascript,Javascript,我正在使用Literal控件动态生成jQuery脚本标记,其中.Text属性的值设置如下: jQueryTag = "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>"; TheJQueryTax.Text = jQueryTag; jQueryTag = jQueryTag + Environment.NewLine + "<script>

我正在使用
Literal
控件动态生成jQuery脚本标记,其中.Text属性的值设置如下:

jQueryTag = "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>";
TheJQueryTax.Text = jQueryTag;
jQueryTag = jQueryTag + Environment.NewLine +
"<script> window.jQuery || document.write('<script src=\"/ExternalScripts/jquery1.js\"></script>')</script>";
jQueryTag=”“;
Text=jQueryTag;
我想在这里添加一个后备方案,类似这样:

jQueryTag = "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>";
TheJQueryTax.Text = jQueryTag;
jQueryTag = jQueryTag + Environment.NewLine +
"<script> window.jQuery || document.write('<script src=\"/ExternalScripts/jquery1.js\"></script>')</script>";
jQueryTag=jQueryTag+Environment.NewLine+
“window.jQuery | | document.write(“”)”;
问题是第一个
标记似乎关闭了开始标记,然后
')
被添加到HTML文档中


如何修复此问题?

尝试拆分字符串的旧技巧:

jQueryTag = jQueryTag + Environment.NewLine +
"<script> window.jQuery || document.write('<script src=\"/ExternalScripts/jquery1.js\"><' + '/script>')</script>";
jQueryTag=jQueryTag+Environment.NewLine+
“window.jQuery | | document.write(“”)”;

但您的问题是什么?我的意思是“')是用来关闭你的('@Neel:是的,这就是它的目的,但第一个在开始之前出现)关闭开始标记。