我试图将表单操作附加到用户放在文本框中的内容并遇到一些问题,有人可以帮我解决这个问题吗?
<form action="http://wfbscd13.cadence.com/cgi-bin/motd.cgi?msg=1&cmd=replace&text=" method="get">
<label for="mestext1"></label>
<input type="text" size="100" maxlength="80">
<input type="submit" name="button1" id="button1" value="Replace">
</form>
答案 0 :(得分:3)
如果出于某种原因,您需要对<form id="myForm" action="http://wfbscd13.cadence.com/cgi-bin/motd.cgi?msg=1&cmd=replace&text=" method="get">
<label for="mestext1"></label>
<input type="text" id="mestext1" size="100" maxlength="80">
<input type="button" name="button1" id="button1" value="Replace" onclick="submitForm();">
</form>
<script type="text/javascript">
function submitForm()
{
var myForm = document.getElementById("myForm");
myForm.action = myForm.action + document.getElementById("mestext1").value;
myForm.submit();
}
</script>
进行硬编码:
msg
这不是正确的方法。您应该添加名为cmd
和<form id="myForm" action="http://wfbscd13.cadence.com/cgi-bin/motd.cgi" method="get">
<label for="mestext1"></label>
<input type="hidden" name="msg" value="1">
<input type="hidden" name="cmd" value="replace">
<input type="text" name="mestext1" id="mestext1" size="100" maxlength="80">
<input type="submit" name="button1" id="button1" value="Replace">
</form>
的输入,并在需要时隐藏它们。然后你的代码将如下所示:
#find out where to split
split_df=as.data.frame(rbind(matrix(0,ncol=ncol(pf)),
apply(diff(as.matrix(ff))!=1,2,cumsum)))
#perform split for each column
split_data=unlist(Map(function(x,y) split(x,y),
pf,
split_df),recursive=FALSE)
#now bind the data together
max_length=max(sapply(split_data,length))
sapply(split_data,function(x) `[<-`(rep(NA_real_,max_length),
1:length(x),
x))