社区
ASP
帖子详情
怎么生成
>?
smallmuda
2003-10-17 12:09:57
<script language="javascript">
function setid()
{
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='日期'+i+':<input type="text" name="datetime'+i+'" value="<%=FormatDateTime(DateAdd("d",i,now()),2)%>" style="width:100" class="tx1"> 答案'+i+':<input type="text" name="answer'+i+'" style="width:30" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
怎么生成
<input type="text" name="datetime'+i+'" value="<%=FormatDateTime(DateAdd("d",i,now()),2)%>?
现在的是生成<input type="text" name="datetime'+i+'" value="2003-10-17">
大家明白我的意思了吗?
...全文
79
16
打赏
收藏
怎么生成<input type=text value=<%=now()%>>?
function setid() { str=''; if(!window.form1.upcount.value) window.form1.upcount.value=1; for(i=1;i<=window.form1.upcount.value;i++) str+='日期'+i+':<input type="text" name="datetime'+i+'" value="<%=FormatDateTime(Date
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
16 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
nolonely
2003-10-17
打赏
举报
回复
soory,手快写错了,我看看
nolonely
2003-10-17
打赏
举报
回复
value="add(\"<%=FormatDateTime(now(),2)%>\",i)"
看都不看?
smallmuda
2003-10-17
打赏
举报
回复
nolonely(琴令人寂,月令人孤)
问题是1,2不定的啊,要循环的啊
我把整页代码发出来好了
<html>
<head>
<title>答案</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="answersave.asp" >
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr>
<td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#CCCCCC" align="left" valign="middle" height="18" width="67"> 答案上传</td>
</tr>
</table>
<table width="71%" border="1" cellspacing="0" cellpadding="5" align="center" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC"> 答案上传</td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="92">
<script language="javascript">
function setid()
{
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='日期'+i+':<input type="text" name="datetime'+i+'" value="<%=FormatDateTime(DateAdd("d",i,now()),2)%>" style="width:100" class="tx1"> 答案'+i+':<input type="text" name="answer'+i+'" style="width:30" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<ul>
<li> 需要提交答案的天数
<input type="text" name="upcount" class="tx" value="1" size="20">
<input type="button" name="Button" class="bt" onclick="setid();" value="· 设定 ·">
</li>
</ul>
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="122">
日期1:<input type="text" name="datetime1" value="" style="width:100" >
答案1:<input type="text" name="answer1" value="" style="width:30" size="5">
</td>
</tr>
<tr align="center" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="24">
<input type="submit" name="Submit" value="· 提交 ·" class="bt">
<input type="reset" name="Submit2" value="· 重执 ·" class="bt">
</td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
setid();
</script>
smallmuda
2003-10-17
打赏
举报
回复
angelheavens(龙辉) ( ) 信
你那样的是
<input type="text" name="datetime1" value="2003-10-17">
<input type="text" name="datetime2" value="2003-10-17">
<input type="text" name="datetime3" value="2003-10-17">
<input type="text" name="datetime4" value="2003-10-17">
angelheavens
2003-10-17
打赏
举报
回复
<script language="javascript">
function setid()
{
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='日期'+i+':<input type="text" name="datetime'+i+'"
value="<%=FormatDateTime(DateAdd("d",i,now()),2)%>" style="width:100" class="tx1"> 答案'+i+':<input type="text"
name="answer'+i+'" style="width:30" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<form name="form1">
请输入要取得几个文本框
<input type="type" value="1" name="upcount">
<span id=upid></span>
<input type="button" value="生成多个文本框" onclick="setid();">
</from>
angelheavens
2003-10-17
打赏
举报
回复
那简单,就是我告诉你的怎么做!
nolonely
2003-10-17
打赏
举报
回复
错误在i是客户端变量,怎么能用在<%%>之间,日期加减用这个
<SCRIPT>
function add(Date1,n){
return new Date(Date.parse(Date1.replace(/-/g,"/"))+3600*1000*24*n).toLocaleDateString().replace(/(\d)\D/g,'$1-').slice(0,-1)
}
alert(add("2002-10-17",1))
alert(add("2002-10-17",2))
</SCRIPT>
Reker熊
2003-10-17
打赏
举报
回复
服務器端腳本無法直接取得客戶端變量i
smallmuda
2003-10-17
打赏
举报
回复
我要的是
<input type="text" name="datetime1" value="2003-10-17">
<input type="text" name="datetime2" value="2003-10-18">
<input type="text" name="datetime3" value="2003-10-19">
<input type="text" name="datetime4" value="2003-10-20">
yangyanggood
2003-10-17
打赏
举报
回复
楼主是不是要获得当天的日期?
chense
2003-10-17
打赏
举报
回复
帮你顶一下!
angelheavens
2003-10-17
打赏
举报
回复
不明白,你究竟是要实现什么功能?要多个<input type="text" name="datetime'+i+'" value="2003-10-17">的话,用个循环,然后再插入即可
avonqin
2003-10-17
打赏
举报
回复
nolonely(琴令人寂,月令人孤) 的可以!!!
我这个也可以,呵呵~~
<script language="javascript">
function setid()
{
var lastdate=new Date();
var ThisVal
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='日期'+i+':<input type=text name=datetime'+i+' value='+lastdate.getYear()+"-"+Number(lastdate.getMonth()+1)+"-"+Number(lastdate.getDate()+i-1)+' style="width:100" class="tx1"> 答案'+i+':<input type="text" name="answer'+i+'" style="width:30" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<form name="form1">
请输入要取得几个文本框
<input type="type" value="1" name="upcount">
<span id=upid></span>
<input type="button" value="生成多个文本框" onclick="setid();" id=button1 name=button1>
</form>
fason
2003-10-17
打赏
举报
回复
把2002-10-17改为"<%=FormatDateTime(now(),2)%>就可以了,刚才是方便测试
stefli
2003-10-17
打赏
举报
回复
在时间后面加(i-1)就可以了。
就是一个时间计算。
当i=1时,就是今天,(i-1=0)
当i=2时,就是每天,(i-1=1) 17+(i-1)=18
依此类推
nolonely
2003-10-17
打赏
举报
回复
<html>
<head>
<title>答案</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td { font-size: 9pt}
a { color: #000000; text-decoration: none}
a:hover { text-decoration: underline}
.tx { height: 16px; width: 30px; border-color: black black #000000; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; font-size: 9pt; background-color: #eeeeee; color: #0000FF}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
.tx1 { height: 20px; width: 30px; font-size: 9pt; border: 1px solid; border-color: black black #000000; color: #0000FF}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="answersave.asp" >
<table border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#CCCCCC" width="91" height="23">
<tr>
<td align="left" valign="middle" height="18" width="18"> </td>
<td bgcolor="#CCCCCC" align="left" valign="middle" height="18" width="67"> 答案上传</td>
</tr>
</table>
<table width="71%" border="1" cellspacing="0" cellpadding="5" align="center" bordercolordark="#CCCCCC" bordercolorlight="#000000">
<tr bgcolor="#CCCCCC">
<td height="22" align="left" valign="middle" bgcolor="#CCCCCC"> 答案上传</td>
</tr>
<tr align="left" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="92">
<script language="javascript">
function add(Date1,n){
return new Date(Date.parse(Date1.replace(/-/g,"/"))+3600*1000*24*n).toLocaleDateString().replace(/(\d)\D/g,'$1-').slice(0,-1)
}
function setid()
{
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=0;i<=window.form1.upcount.value-1;i++)
str+='日期'+i+':<input type="text" name="datetime'+i+'" value="'+add("2002-10-17",i)+'" style="width:100" class="tx1"> 答案'+i+':<input type="text" name="answer'+i+'" style="width:30" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<ul>
<li> 需要提交答案的天数
<input type="text" name="upcount" class="tx" value="1" size="20">
<input type="button" name="Button" class="bt" onclick="setid();" value="· 设定 ·">
</li>
</ul>
</td>
</tr>
<tr align="center" valign="middle">
<td align="left" id="upid" height="122">
日期1:<input type="text" name="datetime1" value="" style="width:100" >
答案1:<input type="text" name="answer1" value="" style="width:30" size="5">
</td>
</tr>
<tr align="center" valign="middle" bgcolor="#eeeeee">
<td bgcolor="#eeeeee" height="24">
<input type="submit" name="Submit" value="· 提交 ·" class="bt">
<input type="reset" name="Submit2" value="· 重执 ·" class="bt">
</td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript">
setid();
</script>
asp.net 前台绑定后台变量方法总结:
<%
= %> 和
<%
# %>的区别
<input
type
="
text
"
value
="<%= GetVariableStr %>" /> <%--前台位置2,绑定的是成员变量--%> "<%= GetFunctionStr() %>" <%--前台位置3,绑定的是一个方法的返回值>--%> </div> </form> </body> </html> ...
用form表单input
type
="file"上传文件(提交前判断)
<input
type
="submit" class="zsk7 submit"
value
="Click upload" id="upload" /> <div class="loading" style="display:none;">Uploading......</div> </div> </form> </div> </div> <script...
input输入框输满3个字符自动跳到下一个input输入框
html代码:<div id="demo"> <form action=""> <input
type
="
text
" maxlength="3"> <input
type
="
text
" maxlength="3"> <input
type
="
text
" maxlength="3"> <in
html input
type
image,
type
="image">
elements of
type
image are used to create graphical submit buttons, i... submit buttons that take the form of an image rather than
text
.None — the
value
attribute should not be specified.EventsNone.I...
input表单开始时间和结束时间的选取,laydate
日期时间:<input
type
="
text
" id="startTime" placeholder='开始时间'> <input
type
="
text
" id="endTime" placeholder='结束时间'> <script src="./laydate/laydate.js"></script> <!-- 改成你的路径 --> <script> ...
ASP
28,391
社区成员
357,059
社区内容
发帖
与我相关
我的任务
ASP
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
复制链接
扫一扫
分享
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章