Javascript 加载jquery后Opera停止加载我的页面

Javascript 加载jquery后Opera停止加载我的页面,javascript,jquery,opera,window.open,Javascript,Jquery,Opera,Window.open,我看了又看,但似乎找不到与我类似的情况。我正在使用javascript打开一个新窗口,然后从该窗口发布信息。我的问题是,我正在尝试加载jquery,然后加载一个脚本以进行验证,这是我在加载jquery之后编写的,但Opera似乎在加载jquery后停止渲染任何内容。 我会发布我的代码,这样也许有人能抓住我错过的东西 a.document.open("text/html"); a.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML

我看了又看,但似乎找不到与我类似的情况。我正在使用javascript打开一个新窗口,然后从该窗口发布信息。我的问题是,我正在尝试加载jquery,然后加载一个脚本以进行验证,这是我在加载jquery之后编写的,但Opera似乎在加载jquery后停止渲染任何内容。 我会发布我的代码,这样也许有人能抓住我错过的东西

a.document.open("text/html");
a.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />' +        '<link href="css/theme-simple.min.css" rel="stylesheet" type="text/css" />' +
    '<link href="css/animate.min.css" rel="stylesheet" type="text/css" />' +
    '<link rel="stylesheet" type="text/css" href="css/style.min.css" />' +
    '<link rel="stylesheet" type="text/css" href="css/body.min.css" />' +
    '<link rel="icon" type="image/png" href="img/favicon.ico"><style>li {font-size:10pt}</style></head><body><span style="display:none">');
var output = document.getElementById('productbox').innerHTML;
//output = output.replace((/\<IMG /,  "\<ignore"));
output = output.replace(new RegExp("<img ", "gi"), '<ignore');
// bodyText.replace(new RegExp("<font>", "gi"), '');
a.document.write(output.replace(/Total/, "Total per server").replace(/Email/, "").replace(/Print/, "").replace(/Qty:/, "").replace(/<img /, "<ignore"));
//a.document.write(output.replace(/Total/, "Total per server").replace(/Email/, "").replace(/Print/, "").replace(/Qty:/, "").replace(/<img src="\/images\/spinning_the_envelope.gif">/, "").replace(/<img src="\/images\/print30px.gif" width="20px">/, ""));

a.document.write('</span><form id="form2" name="form2" method="POST" action="success.php"><input type="hidden" name="formType" value="quote"><input type="hidden" name="fn" value="contact"><input type="hidden" Name="From" value="Quote from Orange Computers"><input type="hidden" name="Phone" value="314-921-9700"><input type="hidden" name="TollFree" value="877-921-9700"><input type="hidden" name="WebSite" value="www.orangecomputers.com"><br />' +
'<table class="topRow" style="width:500px;"><tr><td><div style="float:left;line-height:25px;">Email Address:</div> <div class="valignTop"><span id="anonemail" class="ei"><input type="text" id="HK" name="Email" size="40" style="height:18px;" /></span> <input id="submitAQuote" type="submit" class="btn valignTop" value="Send This Quote" name="button"></div><div style="clear:left;float:left;display:none;color:red;font-weight:bold;" id="Invalid"></td></tr><tr><td>Comments: optional<br /><textarea style="float:left;width:500px;" rows="5" name="Message" cols="60"></textarea></td></tr><tr><td><textarea rows="25" cols="60" name="Quote" style="float:left;width:500px;height:400px;margin:auto;margin-bottom:2px;cursor:default;" readonly>');
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month = curr_month + 1;
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
var curr_sec = d.getSeconds();
var millis = d.getMilliseconds();
var random = Math.floor((Math.random() * 100) + 1);
var quoteNumber = String(curr_date) + String(curr_month) + String(curr_hour) + String(random * 3) + String(curr_min) + String(curr_sec) + String(millis);

a.document.write("Please Note: Prices are subject to change without notice. \n");
a.document.write("Quote number: " + quoteNumber + "\n");
a.document.write("Total Per Server: $");
var price = document.getElementById('product-pric').innerHTML;
a.document.write(price);
a.document.write('\n');
var product = document.getElementById('product-title').innerHTML;
a.document.write(product);
a.document.write('\n');
a.document.write('\n');
//var elems = document.forms.myform.elements;
var count = $("#output li" ).length;

for (var i = 0; i <= count; i++) {
    if (a.document.getElementById('pt' + [i]) !== null) {
        var component = document.getElementById('pt' + [i]).innerHTML;
        /*
                    a.document.write(component);
                    */
        component = component.replace(/&(lt|gt);/g, function (strMatch, p1) {
                return (p1 === "lt") ? "<" : ">";
            });
        var strTagStrippedText = component.replace(/<\/?[^>]+(>|$)/g, "");
        a.document.write(strTagStrippedText);
        a.document.write('\n');
        a.document.write('\n');
    }
    else {}
}
a.document.write("Shipping Not Included");
a.document.write('\n');
/*if (a.document.getElementById('Ground2') !== null) {
    var Ground = document.getElementById('Ground2').innerHTML;
    a.document.write(Ground);
    a.document.write('\n');
}
else {}

if (a.document.getElementById('Second Day Air2') !== null) {
    var SDA = document.getElementById('Second Day Air2').innerHTML;
    a.document.write(SDA);
    a.document.write('\n');
}
else {}

if (a.document.getElementById('Next Day Air2') !== null) {
    var NDA = document.getElementById('Next Day Air2').innerHTML;
    a.document.write(NDA);
}
else {} */


a.document.write('</textarea></tr></td>');
a.document.write("<input type='hidden' name='link' value='http://www.orangecomputers.com/node/index.php?command=getQuote&quoteNum=" + quoteNumber + "' />");
var j = 0;
// var elems = document.forms.myform.elements;

for (var i = 0; i <= count; i++) {

    if (a.document.getElementById('pt' + [i]) !== null) {
        var id = document.getElementById('put' + [i]).value;
        if (document.getElementById('putt' + [i]) !== null) {
            var elemDesc = document.getElementById('putt' + [i]).value;
        }
        if (document.getElementById('putt' + [i]) !== null) {
            var elemPrice = document.getElementById('pri' + [i]).value;
        }
        var name = document.getElementById('put' + [i]).name;
        if (name == 'hddId') {
            a.document.write("<input type='hidden' name='hdd" + j + "' value='" + id + "' />");

            var hdDesc = document.getElementById('hdName' + [i]).value;
            a.document.write("<input type='hidden' name='hddName" + j + "' value='" + hdDesc + "' />");

            var hddQty = document.getElementById('qt' + [i]).value;
            a.document.write("<input type='hidden' name='hddQty" + j + "' value='" + hddQty + "' />");

            var hddId = document.getElementById('hddId' + [i]).value;
            a.document.write("<input type='hidden' name='hdRef" + j + "' value='" + hddId + "' />");

            var hddPrice = document.getElementById('pri' + [i]).value;
            a.document.write("<input type='hidden' name='hddPrice" + j + "' value='" + hddPrice + "' />");
        }
        else if (name == 'cpu') {
            a.document.write("<input type='hidden' name='cpu" + j + "' value='" + id + "' />");
        }
        else {
            a.document.write("<input type='hidden' name='elem" + j + "' value='" + id + "' />");
            if (elemDesc !== undefined) {
                a.document.write("<input type='hidden' name='elemName" + j + "' value='" + elemDesc + "' />");
            }
            if (elemPrice !== undefined) {
                a.document.write("<input type='hidden' name='elemPrice" + j + "' value='" + elemPrice + "' />");
            }
        }


        a.document.write('\n');
        a.document.write('&#10;');
        j++;
    }
    else {}
}

var builder = a.document.getElementById('config').value;
var serverQty = a.document.getElementById('qty').value;
var curPrice = a.document.getElementById('product-pric').innerHTML;

a.document.write("<input type='hidden' name='curPrice' value='" + curPrice + "' />");
a.document.write("<input type='hidden' name='serverQty' value='" + serverQty + "' />");
a.document.write("<input type='hidden' name='builder' value='" + builder + "' />");
a.document.write("<input type='hidden' name='quoteNumber' value='" + quoteNumber + "' />");


a.document.write('<tr><td align="right"><input type="submit" class="btn" value="Send This Quote" name="button"></td></tr></table></form>');
a.document.write('<script type="text/javascript" src="scripts/jquery.js"></script>');
a.document.write('<script type="text/javascript" src="scripts/validator.js"></script>');
a.document.write('</body></html>');
//a.document.close();
if (navigator.appName !== "Microsoft Internet Explorer"){ a.document.close()};
a.document.open(“text/html”);
a、 文件。写入(“”+“”)+
'' +
'' +
'' +
‘li{font size:10pt}’;
var output=document.getElementById('productbox').innerHTML;
//输出=输出。替换(/\/,“”)。替换(/,“”);
a、 文档。写入(“
”+ '电子邮件地址:备注:可选
'; var d=新日期(); var curr_date=d.getDate(); var curr_month=d.getMonth(); 当前月份=当前月份+1; var curr_hour=d.getHours(); var curr_min=d.getMinutes(); var curr_sec=d.getSeconds(); var millis=d.getmillises(); var random=数学地板((数学随机()*100)+1); var quoteNumber=字符串(当前日期)+字符串(当前月份)+字符串(当前小时)+字符串(随机*3)+字符串(当前分钟)+字符串(当前秒)+字符串(毫秒); a、 文件。填写(“请注意:价格如有变动,恕不另行通知。\n”); a、 文件。写入(“报价编号:“+quoteNumber+”\n”); a、 编写(“每台服务器总计:$”; var price=document.getElementById('product-pric').innerHTML; a、 文件。书写(价格); a、 document.write('\n'); var product=document.getElementById('product-title').innerHTML; a、 文件。书写(产品); a、 document.write('\n'); a、 document.write('\n'); //var elems=document.forms.myform.elements; 变量计数=$(“#输出li”)。长度; 对于(var i=0;i |$)/g,“”; a、 文件写入(strTagStrippedText); a、 document.write('\n'); a、 document.write('\n'); } else{} } a、 文件。填写(“不包括装运”); a、 document.write('\n'); /*if(a.document.getElementById('Ground2')!==null){ var Ground=document.getElementById('Ground2').innerHTML; a、 文件。书写(地面); a、 document.write('\n'); } else{} if(a.document.getElementById('Second Day Air2')!==null){ var SDA=document.getElementById('secondday Air2').innerHTML; a、 文件编写(SDA); a、 document.write('\n'); } else{} if(a.document.getElementById('nextday Air2')!==null){ var NDA=document.getElementById('nextday Air2').innerHTML; a、 文件编写(NDA); } else{}*/ a、 文件。写(“”); a、 文件。填写(“”); var j=0; //var elems=document.forms.myform.elements;
对于(var i=0;i第1步:重写它。您不应该使用
文档。编写
,它是古代的残余,有两种非常简单的操作模式

  • DOM仍在加载吗?document.write追加数据
  • DOM加载完成了吗?所有document.write调用将文档重置为新的字符串数据
  • 永远不要使用
    document.write
    。我不知道
    a
    变量是什么,但是您在其中添加的任何内容,都可以通过正确使用
    document.implementation.createDocument
    document.createElement
    和标准的
    appendChild
    等DOM函数来添加

    第二步:利润