保存为不工作 [英] save as is not working
本文介绍了保存为不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经编写了一个html代码来生成表单,当我点击保存时它应该以html格式保存。
i have written an html code to generate the form and when i click on save as it should get saved in html format.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<style type="text/css">
body #s4-leftpanel {
display: none;
}
.s4-ca {
margin-left: 0px;
}
</style>
<script type="text/javascript">
function saveIt(){
var now= new Date();
var year = now.getFullYear();
var month = now.getMonth()+1;
var day = now.getDate();
var hours=now.getHours();
var minutes=now.getMinutes();
var seconds=now.getSeconds();
var currentdate=year+""+month+""+day+""+hours+""+minutes+""+seconds;
var thisUserName = $().SPServices.SPGetCurrentUser ({ fieldName: "Name", debug: false });
var uname=thisUserName.split('\\')[1];
var filename= uname+"-"+currentdate;
document.execCommand("SaveAs", false, filename+".html");
}
function printIt()
{
window.print();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="fltl">
<label title="Name of Principal Office" class="flight12 fltl mt5 mb5" tabindex="0">
Name of Principal Office<span class="asterisk posrl">*</span></label>
<span class="info-icon cp fltl ml5 mt5">
<img src="../Style Library/Gift Funds Images/infoicon.png" alt="Info"/>
</span>
<div class="principaloffice-dropdown ovrh fltl clrl mb5 mt3">
<select class="pt2 flight12" id="principaloffice">
</select>
</div>
<div class="iblock clrl fltl mt5">
<span class="color-red flight12 posrl hidden" id="principalofficerrmsg">
</span>
</div>
</div>
</form>
</body>
</html>
表单将保存在本地但是当重新打开保存的html表单时,它显示错误,如SCRIPT5009:'RegisterSod'未定义
可以为此提供任何帮助.....
the form is getting saved in local but when v reopen the saved html form its showing an error as SCRIPT5009: 'RegisterSod' is undefined
can any one help on this.....
推荐答案
()。SPServices.SPGetCurrentUser({fieldName: 名称,debug: false });
var uname = thisUserName.split(' \\')[ 1 ];
var filename = uname + - 跨度> +的currentdate;
document .execCommand( SaveAs, false ,filename + 。html< /跨度>);
}
function printIt()
{
窗口跨度> .PRINT();
}
< / script >
< < span class =code-leadattribute> / head >
< ; 正文 >
< 表格 id = form1 runat = server >
< div class = fltl < span class =code-keyword>>
< label title = 主要办公室名称 class = flight12 fltl mt5 mb5 tabindex = 0 > ;
主要办事处的名称< span class= asterisk posrl > * < span class =code-keyword>< / span > < / label >
< span class =code-keyword>< span class = info-icon cp fltl ml5 mt5 >
< img src = ../样式库/礼品基金Images / infoicon.pngalt = 信息 / >
< / span >
< div class = principaloffice-dropdown ovrh fltl clrl mb5 mt3 >
< 选择 class = pt2 flight12 id = principaloffice >
< / select >
< / div >
< < span class =code-leadattribute> div class = iblock clrl fltl mt5 >
< span 类 = color-red flight12 posrl hidden id = principalofficerrmsg >
< / span >
< / div >
< / div >
< / form >
< / body >
< / html >
().SPServices.SPGetCurrentUser ({ fieldName: "Name", debug: false }); var uname=thisUserName.split('\\')[1]; var filename= uname+"-"+currentdate; document.execCommand("SaveAs", false, filename+".html"); } function printIt() { window.print(); } </script> </head> <body> <form id="form1" runat="server"> <div class="fltl"> <label title="Name of Principal Office" class="flight12 fltl mt5 mb5" tabindex="0"> Name of Principal Office<span class="asterisk posrl">*</span></label> <span class="info-icon cp fltl ml5 mt5"> <img src="../Style Library/Gift Funds Images/infoicon.png" alt="Info"/> </span> <div class="principaloffice-dropdown ovrh fltl clrl mb5 mt3"> <select class="pt2 flight12" id="principaloffice"> </select> </div> <div class="iblock clrl fltl mt5"> <span class="color-red flight12 posrl hidden" id="principalofficerrmsg"> </span> </div> </div> </form> </body> </html>
表单将保存在本地但是当重新打开保存的html表单时,它显示错误,如SCRIPT5009:'RegisterSod'未定义
可以为此提供任何帮助.....
the form is getting saved in local but when v reopen the saved html form its showing an error as SCRIPT5009: 'RegisterSod' is undefined
can any one help on this.....
这篇关于保存为不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文