js,html问题:为什么我的的新窗口无法显示出那两个for语句的值




<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>输入页</title>
<script language="javascript">

function check()
{
 var a=document.getElementById("myname").value;
 var b=document.getElementById("mysex").value;
 var c=document.getElementById("myage").value;
 var d=document.getElementById("mytel").value;
 var e=document.getElementById("myadd").value;
 var f=document.getElementById("imgOne").value;
 var g=document.getElementById("hobby").value;
 if(a==""||a==null)
{
    alert("基本信息姓名未填!");
    ff.myname.focus();
    return;
}
 if(b==""||b==null)
{
    alert("基本信息性别未填!");
    ff.mysex.focus();
    return;
}
if(c==""||c==null)
{
    alert("基本信息年龄未填!");
    ff.myage.focus();
    return;
}
if(d==""||d==null)
{
    alert("基本信息电话未填!");
    ff.mytel.focus();
    return;
}
if(e==""||e==null)
{
    alert("基本信息地址未填!");
    ff.myadd.focus();
    return;
}
if(f==""||f==null)
{
    alert("基本信息照片未填!");
    ff.mypic.focus();
    return;
}
if(g.length<="1")
{
    alert("爱好特长字数过少!");
    ff.hobby.focus();
    return;
}
else newpage();

}

//function newpage()
//{
/*
    var a=document.getElementById("myname").value;
    var b=document.getElementById("mysex").value;
    var c=document.getElementById("myage").value;
    var d=document.getElementById("mytel").value;
    var e=document.getElementById("myadd").value;
    var f=url;
    var g=document.getElementById("hobby").value;
    var dw;var txtid;
        dw=window.document.open();
        dw=document.write("<html><head><title>一个新的窗口</title>");
        dw=document.write("<style typewox='text/css'>");
        dw=document.write("div#ff{width:55%;margin:auto;}");
        dw=document.write("div#grjl {background-color:#77baab;}");
        dw=document.write("div#jbxx {height:250px;width:70%;float:left;}");
        dw=document.write("div#pic {height:250px;width:5%;float:right;}");
        dw=document.write("h1 {margin-bottom:0;text-align:center;}");
        dw=document.write("h2 {margin-bottom:0;font-size:18px;}");
        dw=document.write("</style>");
        dw=document.write("</head><body>");
        dw=document.write("<div id='ff'>");
        dw=document.write("<div id='grjl'><h1>个人简历</h1></div>");
        dw=document.write("<div id='jbxx'><h2>基本信息</h2>");
        dw=document.write("<div id='pic'><img src="+f+" width='200' height='210'></div>");
        dw=document.write("姓名:"+a+"<br /><br />");
        dw=document.write("性别:"+b+"<br /><br />");
        dw=document.write("年龄:"+c+"<br /><br />");
        dw=document.write("住址:"+e+"<br /><br />");
        dw=document.write("电话:"+d+"<br /><br /><br />");
        dw=document.write("<div id='edu'><h2>教育经历</h2>");
        dw=document.write("<ul>");
        for(var i=0;i<nub;i++){
            txtid=educ[i];
            dw.write("<li>"+printText(txtid)+"</li>");
        };
        dw=document.write("</ul>");
        dw=document.write("</div>");
        dw=document.write("<div name='jiang'><h2>奖励奖项</h2>");
        dw=document.write("<ul>");
        for(var i=0;i<num;i++){
            txtid=hno[i];
            dw.write("<li>"+printText(txtid)+"</li>");
        };

        dw=document.write("</ul></div>");
        dw=document.write("<div name='NewHobby'><h2>爱好特长</h2><br />");
        dw=document.write(""+hobby+"</div>");
        dw=document.write("</div></div></body></html>");
        dw.document.close();

*///}


var nub=0;
var educ= new Array();
function addText1()
        {
            nub++;
            var txt=document.createElement("input");
            var br=document.createElement("br");
            txt.type="text";
            txt.id="txt"+nub.toString();
            educ[nub]=txt.id;
            txt.placeholder="请输入";
            document.getElementById("edu").appendChild(br);
            document.getElementById("edu").appendChild(txt);
        }


var num=0;
var hno=new Array();    
function addText()
        {
            num++;
            var txtt=document.createElement("input");
            var br=document.createElement("br");
            txtt.type="text";
            txtt.id="text"+num.toString();
            hno[num]=txtt.id;
            txtt.placeholder="请输入";
            document.getElementById("jiang").appendChild(br);
            document.getElementById("jiang").appendChild(txtt);
        }

function newpage()
{
    var a=document.getElementById("myname").value;
    var b=document.getElementById("mysex").value;
    var c=document.getElementById("myage").value;
    var d=document.getElementById("mytel").value;
    var e=document.getElementById("myadd").value;
    var f=url;
    var g=document.getElementById("hobby").value;
    var dw;var txtid;
        dw=window.document.open();
        dw=document.write("<html><head><title>一个新的窗口</title>");
        dw=document.write("<style typewox='text/css'>");
        dw=document.write("div#ff{width:55%;margin:auto;}");
        dw=document.write("div#grjl {background-color:#77baab;}");
        dw=document.write("div#jbxx {height:250px;width:70%;float:left;}");
        dw=document.write("div#pic {height:250px;width:5%;float:right;}");
        dw=document.write("h1 {margin-bottom:0;text-align:center;}");
        dw=document.write("h2 {margin-bottom:0;font-size:18px;}");
        dw=document.write("</style>");
        dw=document.write("</head><body>");
        dw=document.write("<div id='ff'>");
        dw=document.write("<div id='grjl'><h1>个人简历</h1></div>");
        dw=document.write("<div id='jbxx'><h2>基本信息</h2>");
        dw=document.write("<div id='pic'><img src="+f+" width='200' height='210'></div>");
        dw=document.write("姓名:"+a+"<br /><br />");
        dw=document.write("性别:"+b+"<br /><br />");
        dw=document.write("年龄:"+c+"<br /><br />");
        dw=document.write("住址:"+e+"<br /><br />");
        dw=document.write("电话:"+d+"<br /><br /><br />");
        dw=document.write("<div id='edu'><h2>教育经历</h2>");
        dw=document.write("<ul>");
        for(var i=0;i<nub;i++){
            txtid=educ[i];
            dw.write("<li>"+printText(txtid)+"</li>");
        };
        dw=document.write("</ul>");
        dw=document.write("</div>");
        dw=document.write("<div name='jiang'><h2>奖励奖项</h2>");
        dw=document.write("<ul>");
        for(var i=0;i<num;i++){
            txtid=hno[i];
            dw.write("<li>"+printText(txtid)+"</li>");
        };

        dw=document.write("</ul></div>");
        dw=document.write("<div name='NewHobby'><h2>爱好特长</h2><br />");
        dw=document.write(""+hobby+"</div>");
        dw=document.write("</div></div></body></html>");
        dw.document.close();

}

var url;
function getFileUrl(sourceId) {

        if (navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) { 
            //url = document.getElementById(sourceId).value;
            document.all.imgOne.select();
            $("#preview").focus();
            url = document.selection.createRange().text;

        } else if (navigator.userAgent.indexOf("Firefox") > 0) { // Firefox 
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        } else if (navigator.userAgent.indexOf("Chrome") > 0) { // Chrome 
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }else if(navigator.userAgent.indexOf("MSIE 10.0") > 0){
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }else{
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }
        return url;
    }
 function preImg(sourceId, targetId) {
        var url = getFileUrl(sourceId);
        var imgPre = document.getElementById(targetId);
         if(window.navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) {
             var picpreview=document.getElementById("preview");
             picpreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;
         }else{
             imgPre.src = url;
         }

    }
</script>
<h3>基本信息</h3>
<form name="ff" id="ff">
<div style="width:400px;height:550px;background:#9FF"id="jbxx">
<ul>
    <li>请输入姓名:</li><input type="text"name="myname"id="myname"placeholder="必填项"></li>
    <li>请输入性别:</li><input type="text" name="mysex"id="mysex"placeholder="必填项" ></li>
    <li>请输入年龄:</li><input type="text"name="myage"id="myage"placeholder="必填项"></li>
    <li>请输入电话:</li><input type="text"name="mytel"id="mytel"placeholder="必填项"></li>
    <li>请输入住址:</li><input type="text"name="myadd"id="myadd"placeholder="必填项"></li>
</ul>   
请输入照片:<input type="file" name="imgOne" id="imgOne" onchange="preImg(this.id,'imgPre');" /> 
<div id="preview"width:200px;height:210px;border:solid 1px black;">
  <div align="right"><img src="" name="imgPre" width="200" height="210px" align="left" id="imgPre" style="display: block;" /></div>
</div>
</div>
<hr width="1340" size="1" />
<div id="edu">
<h3>教育经历</h3>
<span class="STYLE1">请输入从初中开始至今的教育经历:</span>
</div>
<input type="button" name="btn1" value="动态添加文本框" onclick="addText1();" />
<hr width="1340" size="1" />
<div id="jiang">
<h3>获奖经历</h3>
<span class="STYLE1">请输入你获得的任何奖励:</span>
</div>
<input type="button" name="btn2" value="动态添加文本框" onclick="addText();" />
<hr width="1340" size="1" />
<h3>爱好特长:</h3>
<div id="fm">
请输入你的爱好特长,不少于20字:<br></br>
<textarea id="hobby"></textarea> 
<hr width="1340" size="1" />
</div>
<input name="提交" type="button" onclick="check()" value="提交"/>
<input type="reset" value="重置" />
</form>
</body>
</html>

啊啊啊啊啊为什么没有分段!

代码重新整理下吧,没人看得懂。

代码重新整理下吧,有单行注释都不知道哪些代码被注释了

把代码整理一下吧,看着头晕

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



输入页 //按钮检测函数,用于检测输入框是否为空。全部不为空调用newpage()函数 function check() { var a=document.getElementById("myname").value; var b=document.getElementById("mysex").value; var c=document.getElementById("myage").value; var d=document.getElementById("mytel").value; var e=document.getElementById("myadd").value; var f=document.getElementById("imgOne").value; var g=document.getElementById("hobby").value; if(a==""||a==null) { alert("基本信息姓名未填!"); ff.myname.focus(); return; } if(b==""||b==null) { alert("基本信息性别未填!"); ff.mysex.focus(); return; } if(c==""||c==null) { alert("基本信息年龄未填!"); ff.myage.focus(); return; } if(d==""||d==null) { alert("基本信息电话未填!"); ff.mytel.focus(); return; } if(e==""||e==null) { alert("基本信息地址未填!"); ff.myadd.focus(); return; } if(f==""||f==null) { alert("基本信息照片未填!"); ff.mypic.focus(); return; } if(g.length<="1") { alert("爱好特长字数过少!"); ff.hobby.focus(); return; } else newpage(); } var nub=0; var educ= new Array(); //动态添加文本框函数,将每一个动态添加框的id值赋给educ数组 function addText1() { nub++; var txt=document.createElement("input"); var br=document.createElement("br"); txt.type="text"; txt.id="txt"+nub.toString(); educ[nub]=txt.id; txt.placeholder="请输入"; document.getElementById("edu").appendChild(br); document.getElementById("edu").appendChild(txt); } //同上,赋给hno数组 var num=0; var hno=new Array(); function addText() { num++; var txtt=document.createElement("input"); var br=document.createElement("br"); txtt.type="text"; txtt.id="text"+num.toString(); hno[num]=txtt.id; txtt.placeholder="请输入"; document.getElementById("jiang").appendChild(br); document.getElementById("jiang").appendChild(txtt); } //打开一个新窗口 function newpage() { var a=document.getElementById("myname").value; var b=document.getElementById("mysex").value; var c=document.getElementById("myage").value; var d=document.getElementById("mytel").value; var e=document.getElementById("myadd").value; var f=url; var g=document.getElementById("hobby").value; var dw;var txtid; dw=window.document.open(); dw=document.write("<html><head><title>一个新的窗口</title>"); dw=document.write("<style typewox='text/css'>"); dw=document.write("div#ff{width:55%;margin:auto;}"); dw=document.write("div#grjl {background-color:#77baab;}"); dw=document.write("div#jbxx {height:250px;width:70%;float:left;}"); dw=document.write("div#pic {height:250px;width:5%;float:right;}"); dw=document.write("h1 {margin-bottom:0;text-align:center;}"); dw=document.write("h2 {margin-bottom:0;font-size:18px;}"); dw=document.write("</style>"); dw=document.write("</head><body>"); dw=document.write("<div id='ff'>"); dw=document.write("<div id='grjl'><h1>个人简历</h1></div>"); dw=document.write("<div id='jbxx'><h2>基本信息</h2>"); dw=document.write("<div id='pic'><img src="+f+" width='200' height='210'></div>"); dw=document.write("姓名:"+a+"<br /><br />"); dw=document.write("性别:"+b+"<br /><br />"); dw=document.write("年龄:"+c+"<br /><br />"); dw=document.write("住址:"+e+"<br /><br />"); dw=document.write("电话:"+d+"<br /><br /><br />"); dw=document.write("<div id='edu'><h2>教育经历</h2>"); dw=document.write("<ul>"); for(var i=0;i<nub;i++){ txtid=educ[i]; dw.write("<li>"+printText(txtid)+"</li>"); };//就是这里!!!浏览器报错说educ未声明。如果我想调用动态添加输入框函数中的数组值该怎么做! dw=document.write("</ul>"); dw=document.write("</div>"); dw=document.write("<div name='jiang'><h2>奖励奖项</h2>"); dw=document.write("<ul>"); for(var i=0;i<num;i++){ txtid=hno[i]; dw.write("<li>"+printText(txtid)+"</li>"); };//这里跟上面一样! dw=document.write("</ul></div>"); dw=document.write("<div name='NewHobby'><h2>爱好特长</h2><br />"); dw=document.write(""+hobby+"</div>"); dw=document.write("</div></div></body></html>"); dw.document.close(); } var url; //这是添加本地图片函数。跟我的问题应该不相关 function getFileUrl(sourceId) { if (navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) { //url = document.getElementById(sourceId).value; document.all.imgOne.select(); $("#preview").focus(); url = document.selection.createRange().text; } else if (navigator.userAgent.indexOf("Firefox") > 0) { // Firefox url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } else if (navigator.userAgent.indexOf("Chrome") > 0) { // Chrome url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); }else if(navigator.userAgent.indexOf("MSIE 10.0") > 0){ url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); }else{ url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } return url; } //将添加的图片显示出函数 function preImg(sourceId, targetId) { var url = getFileUrl(sourceId); var imgPre = document.getElementById(targetId); if(window.navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) { var picpreview=document.getElementById("preview"); picpreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url; }else{ imgPre.src = url; } }

基本信息

  • 请输入姓名:
  • 请输入性别:
  • 请输入年龄:
  • 请输入电话:
  • 请输入住址:
请输入照片:

教育经历

请输入从初中开始至今的教育经历:

获奖经历

请输入你获得的任何奖励:

爱好特长:

请输入你的爱好特长,不少于20字:


 <!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>输入页</title>
<script language="javascript">
//按钮检测函数,用于检测输入框是否为空。全部不为空调用newpage()函数       
function check()
{
var a=document.getElementById("myname").value;
var b=document.getElementById("mysex").value;
var c=document.getElementById("myage").value;
var d=document.getElementById("mytel").value;
var e=document.getElementById("myadd").value;
var f=document.getElementById("imgOne").value;
var g=document.getElementById("hobby").value;
if(a==""||a==null)
{
        alert("基本信息姓名未填!");
        ff.myname.focus();
        return;
}
if(b==""||b==null)
{
        alert("基本信息性别未填!");
        ff.mysex.focus();
        return;
}
if(c==""||c==null)
{
        alert("基本信息年龄未填!");
        ff.myage.focus();
        return;
}
if(d==""||d==null)
{
        alert("基本信息电话未填!");
        ff.mytel.focus();
        return;
}
if(e==""||e==null)
{
        alert("基本信息地址未填!");
        ff.myadd.focus();
        return;
}
if(f==""||f==null)
{
        alert("基本信息照片未填!");
        ff.mypic.focus();
        return;
}
if(g.length<="1")
{
        alert("爱好特长字数过少!");
        ff.hobby.focus();
        return;
}
else newpage();

}         
var nub=0;
var educ= new Array();
//动态添加文本框函数,将每一个动态添加框的id值赋给educ数组
function addText1()
                {
                        nub++;
                        var txt=document.createElement("input");
                        var br=document.createElement("br");
                        txt.type="text";
                        txt.id="txt"+nub.toString();
                        educ[nub]=txt.id;
                        txt.placeholder="请输入";
                        document.getElementById("edu").appendChild(br);
                        document.getElementById("edu").appendChild(txt);
                }

//同上,赋给hno数组
var num=0;
var hno=new Array();        
function addText()
                {
                        num++;
                        var txtt=document.createElement("input");
                        var br=document.createElement("br");
                        txtt.type="text";
                        txtt.id="text"+num.toString();
                        hno[num]=txtt.id;
                        txtt.placeholder="请输入";
                        document.getElementById("jiang").appendChild(br);
                        document.getElementById("jiang").appendChild(txtt);
                }
//打开一个新窗口                
function newpage()
{
        var a=document.getElementById("myname").value;
        var b=document.getElementById("mysex").value;
        var c=document.getElementById("myage").value;
        var d=document.getElementById("mytel").value;
        var e=document.getElementById("myadd").value;
        var f=url;
        var g=document.getElementById("hobby").value;
        var dw;var txtid;
                dw=window.document.open();
                dw=document.write("<html><head><title>一个新的窗口</title>");
                dw=document.write("<style typewox='text/css'>");
                dw=document.write("div#ff{width:55%;margin:auto;}");
                dw=document.write("div#grjl {background-color:#77baab;}");
                dw=document.write("div#jbxx {height:250px;width:70%;float:left;}");
                dw=document.write("div#pic {height:250px;width:5%;float:right;}");
                dw=document.write("h1 {margin-bottom:0;text-align:center;}");
                dw=document.write("h2 {margin-bottom:0;font-size:18px;}");
                dw=document.write("</style>");
                dw=document.write("</head><body>");
                dw=document.write("<div id='ff'>");
                dw=document.write("<div id='grjl'><h1>个人简历</h1></div>");
                dw=document.write("<div id='jbxx'><h2>基本信息</h2>");
                dw=document.write("<div id='pic'><img src="+f+" width='200' height='210'></div>");
                dw=document.write("姓名:"+a+"<br /><br />");
                dw=document.write("性别:"+b+"<br /><br />");
                dw=document.write("年龄:"+c+"<br /><br />");
                dw=document.write("住址:"+e+"<br /><br />");
                dw=document.write("电话:"+d+"<br /><br /><br />");
        dw=document.write("<div id='edu'><h2>教育经历</h2>");
                dw=document.write("<ul>");
                for(var i=0;i<nub;i++){
                        txtid=educ[i];
                        dw.write("<li>"+printText(txtid)+"</li>");
                };//就是这里!!!浏览器报错说educ未声明。如果我想调用动态添加输入框函数中的数组值该怎么做!
                dw=document.write("</ul>");
                dw=document.write("</div>");
                dw=document.write("<div name='jiang'><h2>奖励奖项</h2>");
                dw=document.write("<ul>");
                for(var i=0;i<num;i++){
                        txtid=hno[i];
                        dw.write("<li>"+printText(txtid)+"</li>");
                };//这里跟上面一样!

                dw=document.write("</ul></div>");
                dw=document.write("<div name='NewHobby'><h2>爱好特长</h2><br />");
                dw=document.write(""+hobby+"</div>");
                dw=document.write("</div></div></body></html>");
                dw.document.close();

}

var url;
//这是添加本地图片函数。跟我的问题应该不相关
function getFileUrl(sourceId) {

        if (navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) { 
            //url = document.getElementById(sourceId).value;
            document.all.imgOne.select();
            $("#preview").focus();
            url = document.selection.createRange().text;

        } else if (navigator.userAgent.indexOf("Firefox") > 0) { // Firefox 
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        } else if (navigator.userAgent.indexOf("Chrome") > 0) { // Chrome 
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }else if(navigator.userAgent.indexOf("MSIE 10.0") > 0){
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }else{
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }
        return url;
    }
//将添加的图片显示出函数
function preImg(sourceId, targetId) {
        var url = getFileUrl(sourceId);
        var imgPre = document.getElementById(targetId);
         if(window.navigator.userAgent.indexOf("MSIE") >= 1 && !(navigator.userAgent.indexOf("MSIE 10.0") > 0) ) {
             var picpreview=document.getElementById("preview");
             picpreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;
         }else{
             imgPre.src = url;
         }

    }
</script>
<h3>基本信息</h3>
<form name="ff" id="ff">
<div style="width:400px;height:550px;background:#9FF"id="jbxx">
<ul>
        <li>请输入姓名:</li><input type="text"name="myname"id="myname"placeholder="必填项"></li>
        <li>请输入性别:</li><input type="text" name="mysex"id="mysex"placeholder="必填项" ></li>
        <li>请输入年龄:</li><input type="text"name="myage"id="myage"placeholder="必填项"></li>
        <li>请输入电话:</li><input type="text"name="mytel"id="mytel"placeholder="必填项"></li>
        <li>请输入住址:</li><input type="text"name="myadd"id="myadd"placeholder="必填项"></li>
</ul>        
请输入照片:<input type="file" name="imgOne" id="imgOne" /> 
<div id="preview"width:200px;height:210px;border:solid 1px black;">
  <div align="right"><img src="" name="imgPre" width="200" height="210px" align="left" id="imgPre" style="display: block;" /></div>
</div>
</div>
<hr width="1340" size="1" />
<div id="edu">
<h3>教育经历</h3>
<span class="STYLE1">请输入从初中开始至今的教育经历:</span>
</div>
<input type="button" name="btn1" value="动态添加文本框" />
<hr width="1340" size="1" />
<div id="jiang">
<h3>获奖经历</h3>
<span class="STYLE1">请输入你获得的任何奖励:</span>
</div>
<input type="button" name="btn2" value="动态添加文本框" />
<hr width="1340" size="1" />
<h3>爱好特长:</h3>
<div id="fm">
请输入你的爱好特长,不少于20字:<br></br>
<textarea id="hobby"></textarea> 
<hr width="1340" size="1" />
</div>
<input name="提交" type="button" value="提交"/>
<input type="reset" value="重置" />
</form>
</body>
</html>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 输入页 //按钮检测函数,用于检测输入框是否为空。全部不为空调用newpage()函数<br> function check() { var a=document.getElementById(&quot;myname&quot;).value; var b=document.getElementById(&quot;mysex&quot;).value; var c=document.getElementById(&quot;myage&quot;).value; var d=document.getElementById(&quot;mytel&quot;).value; var e=document.getElementById(&quot;myadd&quot;).value; var f=document.getElementById(&quot;imgOne&quot;).value; var g=document.getElementById(&quot;hobby&quot;).value; if(a==&quot;&quot;||a==null) { alert(&quot;基本信息姓名未填!&quot;); ff.myname.focus(); return; } if(b==&quot;&quot;||b==null) { alert(&quot;基本信息性别未填!&quot;); ff.mysex.focus(); return; } if(c==&quot;&quot;||c==null) { alert(&quot;基本信息年龄未填!&quot;); ff.myage.focus(); return; } if(d==&quot;&quot;||d==null) { alert(&quot;基本信息电话未填!&quot;); ff.mytel.focus(); return; } if(e==&quot;&quot;||e==null) { alert(&quot;基本信息地址未填!&quot;); ff.myadd.focus(); return; } if(f==&quot;&quot;||f==null) { alert(&quot;基本信息照片未填!&quot;); ff.mypic.focus(); return; } if(g.length&lt;=&quot;1&quot;) { alert(&quot;爱好特长字数过少!&quot;); ff.hobby.focus(); return; } else newpage();</li> </ol> <p>}<br><br> var nub=0;<br> var educ= new Array();<br> //动态添加文本框函数,将每一个动态添加框的id值赋给educ数组<br> function addText1()<br> {<br> nub++;<br> var txt=document.createElement(&quot;input&quot;);<br> var br=document.createElement(&quot;br&quot;);<br> txt.type=&quot;text&quot;;<br> txt.id=&quot;txt&quot;+nub.toString();<br> educ[nub]=txt.id;<br> txt.placeholder=&quot;请输入&quot;;<br> document.getElementById(&quot;edu&quot;).appendChild(br);<br> document.getElementById(&quot;edu&quot;).appendChild(txt);<br> }</p> <p>//同上,赋给hno数组<br> var num=0;<br> var hno=new Array();<br><br> function addText()<br> {<br> num++;<br> var txtt=document.createElement(&quot;input&quot;);<br> var br=document.createElement(&quot;br&quot;);<br> txtt.type=&quot;text&quot;;<br> txtt.id=&quot;text&quot;+num.toString();<br> hno[num]=txtt.id;<br> txtt.placeholder=&quot;请输入&quot;;<br> document.getElementById(&quot;jiang&quot;).appendChild(br);<br> document.getElementById(&quot;jiang&quot;).appendChild(txtt);<br> }<br> //打开一个新窗口<br><br> function newpage()<br> {<br> var a=document.getElementById(&quot;myname&quot;).value;<br> var b=document.getElementById(&quot;mysex&quot;).value;<br> var c=document.getElementById(&quot;myage&quot;).value;<br> var d=document.getElementById(&quot;mytel&quot;).value;<br> var e=document.getElementById(&quot;myadd&quot;).value;<br> var f=url;<br> var g=document.getElementById(&quot;hobby&quot;).value;<br> var dw;var txtid;<br> dw=window.document.open();<br> dw=document.write(&quot;<html><head><title>一个新的窗口</title>&quot;);<br> dw=document.write(&quot;<style typewox='text/css'>&quot;);<br> dw=document.write(&quot;div#ff{width:55%;margin:auto;}&quot;);<br> dw=document.write(&quot;div#grjl {background-color:#77baab;}&quot;);<br> dw=document.write(&quot;div#jbxx {height:250px;width:70%;float:left;}&quot;);<br> dw=document.write(&quot;div#pic {height:250px;width:5%;float:right;}&quot;);<br> dw=document.write(&quot;h1 {margin-bottom:0;text-align:center;}&quot;);<br> dw=document.write(&quot;h2 {margin-bottom:0;font-size:18px;}&quot;);<br> dw=document.write(&quot;</style>&quot;);<br> dw=document.write(&quot;</head><body>&quot;);<br> dw=document.write(&quot;<div id='ff'>&quot;);<br> dw=document.write(&quot;<div id='grjl'><h1>个人简历</h1></div>&quot;);<br> dw=document.write(&quot;<div id='jbxx'><h2>基本信息</h2>&quot;);<br> dw=document.write(&quot;<div id='pic'><img src="+f+" width='200' height='210'></div>&quot;);<br> dw=document.write(&quot;姓名:&quot;+a+&quot;<br /><br />&quot;);<br> dw=document.write(&quot;性别:&quot;+b+&quot;<br /><br />&quot;);<br> dw=document.write(&quot;年龄:&quot;+c+&quot;<br /><br />&quot;);<br> dw=document.write(&quot;住址:&quot;+e+&quot;<br /><br />&quot;);<br> dw=document.write(&quot;电话:&quot;+d+&quot;<br /><br /><br />&quot;);<br> dw=document.write(&quot;<div id='edu'><h2>教育经历</h2>&quot;);<br> dw=document.write(&quot;<ul>&quot;);<br> for(var i=0;i<nub;i++){<br> txtid=educ[i];<br> dw.write("<li>&quot;+printText(txtid)+&quot;</li>&quot;);<br> };//就是这里!!!浏览器报错说educ未声明。如果我想调用动态添加输入框函数中的数组值该怎么做!<br> dw=document.write(&quot;</ul>&quot;);<br> dw=document.write(&quot;</div>&quot;);<br> dw=document.write(&quot;<div name='jiang'><h2>奖励奖项</h2>&quot;);<br> dw=document.write(&quot;<ul>&quot;);<br> for(var i=0;i<num;i++){<br> txtid=hno[i];<br> dw.write("<li>&quot;+printText(txtid)+&quot;</li>&quot;);<br> };//这里跟上面一样!</p> <pre><code> dw=document.write(&quot;&lt;/ul&gt;&lt;/div&gt;&quot;); dw=document.write(&quot;&lt;div name=&#39;NewHobby&#39;&gt;&lt;h2&gt;爱好特长&lt;/h2&gt;&lt;br /&gt;&quot;); dw=document.write(&quot;&quot;+hobby+&quot;&lt;/div&gt;&quot;); dw=document.write(&quot;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&quot;); dw.document.close(); </code></pre> <p>}</p> <p>var url;<br> //这是添加本地图片函数。跟我的问题应该不相关<br> function getFileUrl(sourceId) {</p> <pre><code> if (navigator.userAgent.indexOf(&quot;MSIE&quot;) &gt;= 1 &amp;&amp; !(navigator.userAgent.indexOf(&quot;MSIE 10.0&quot;) &gt; 0) ) { //url = document.getElementById(sourceId).value; document.all.imgOne.select(); $(&quot;#preview&quot;).focus(); url = document.selection.createRange().text; } else if (navigator.userAgent.indexOf(&quot;Firefox&quot;) &gt; 0) { // Firefox url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } else if (navigator.userAgent.indexOf(&quot;Chrome&quot;) &gt; 0) { // Chrome url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); }else if(navigator.userAgent.indexOf(&quot;MSIE 10.0&quot;) &gt; 0){ url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); }else{ url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0)); } return url; } </code></pre> <p>//将添加的图片显示出函数<br> function preImg(sourceId, targetId) {<br> var url = getFileUrl(sourceId);<br> var imgPre = document.getElementById(targetId);<br> if(window.navigator.userAgent.indexOf(&quot;MSIE&quot;) &gt;= 1 &amp;&amp; !(navigator.userAgent.indexOf(&quot;MSIE 10.0&quot;) &gt; 0) ) {<br> var picpreview=document.getElementById(&quot;preview&quot;);<br> picpreview.filters.item(&quot;DXImageTransform.Microsoft.AlphaImageLoader&quot;).src = url;<br> }else{<br> imgPre.src = url;<br> }</p> <pre><code>} </code></pre> <p>

    基本信息

    • 请输入姓名:
    • 请输入性别:
    • 请输入年龄:
    • 请输入电话:
    • 请输入住址:
    请输入照片:

    教育经历

    请输入从初中开始至今的教育经历:

    获奖经历

    请输入你获得的任何奖励:

    爱好特长:

    请输入你的爱好特长,不少于20字: