在同一页面上创建表单? [英] create form on same page?

查看:86
本文介绍了在同一页面上创建表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


如何在不使用document.write()打开

新窗口的情况下创建表单?


我想它与使用< SPAN ID =''idvalue''etc元素和

document.getElementById(" idvalue")。innerHTML有关但不清楚怎么办

它...


这就是我现在这样做的方式...


document.write("< form action =''http://website/path/formmail-nms.cgi''

method =''post''>") ;

document.write("< input type =''hidden''name =''slidervalues''value =''" +

str_questions +" ;''>");

document.write("< input type =''hidden''name =''recipient''value

= ''extraemails''>");

document.write("< input type =''submit''value =''send''

点击数 - '' sendslidervalues '' & gt;");

document.write("< / form>");


干杯


Geoff

解决方案



" Geoff Cox" < GE ******* @ notquitecorrectfreeuk.com>在消息中写道

news:kn ******************************** @ 4ax.com ...

你好,

如何在不使用document.write()打开
新窗口的情况下创建表单?

我想它与使用< SPAN ID =''idvalue''etc元素和
document.getElementById(" idvalue")。innerHTML有关但不清楚如何做
它......

这就是我现在这样做的方式......

document.write("< form action =''http:// website /path/formmail-nms.cgi''
method =''post''>");
document.write("< input type =''hidden''name =' 'slidervalues''value =''" +
str_questions +"''>");
document.write("< input type =''hidden''name =' '收件人''价值
=''extraemails''>");
document.write("< input type =''submit''value ='''send''
上舔 - ''sentlidervalues''>");
document.write("< / form>");


我不确定到目前为止我是否按照这个问题。为什么你需要创建表格

客户端?

干杯

Geoff



2005年9月10日星期六14:21:41 GMT,Zoe Brown

< zo *********** @ NOSPAA-Mtesco达网络>写道:


Geoff Cox < GE ******* @ notquitecorrectfreeuk.com>在消息中写道
新闻:kn ******************************** @ 4ax.com .. < blockquote class =post_quotes>你好,

如何在不使用document.write()打开
新窗口的情况下创建表单?

我想象它与使用< SPAN ID =''idvalue''etc元素和
document.getElementById(" idvalue")。innerHTML有关,但不清楚如何做
它...

这就是我现在这样做的方式......

document.write("< form action =''http:// website / path / formmail -nms.cgi''
method =''post''>");
document.write("< input type =''hidden''name =''slidervalues'' value =''" +
str_questions +"''>");
document.write("< input type =''hidden''name =''recipient''值
=''extraemails''>");
document.write("< input type =''submit''value ='''发送''
onlick - ''sentlidervalues''>");
document.write("< / form>");
我不确定到目前为止我是否按照这个问题。为什么你需要创建表格
客户端?




Zoe,


我有一套数组中的滑块值我想传递给

formmail-nms.cgi脚本,所以我的想法是将它们放入一个带有

提交按钮等的表单中。 ..有更好的方法吗?


干杯


Geoff




干杯

Geoff




Geoff Cox写道:

你好,

如何在不使用document.write()打开
新窗口的情况下创建表单?




全部用弹出窗口写你可以用同样的方式

那就是说:不是你用的是


mytext =''< form action =" page.htm" method =" get">'';

mytext + =''< h2>某个标题< \ / h2>'';

mytext + = ''< p>名称:<输入类型=文字名称="名称">'';

mytext + =''< p>名字:< input type = text name =" Fname">'';

mytext + =''< p>名称:< input type = submit value =" Send">'';

mytext + =''< \ / form>'';


然后选择:


truc = window.open();

with(truc){open(); write(mytext); close();}





document.geElementById(''''')。innerHTML = mytext;


更优雅的方式是使用DOM的节点


< script type =" text / javascript">

函数go(){

var frm = document.createElement('' FORM'');

frm.setAttribute(''id'',''myForm'');

frm.setAttribute(''name '',''myForm'');

frm.setAttribute(''action'',''page.htm'');


var elem = document.createElement(''H2'');

elem.innerHTML =''some title'';

frm.appendChild(elem);


elem = document.createElement(''P'');

var texto = document.createTextNode(''Name:'');

var field = document.createElement(''INPUT'');

field.setAttribute(''name'',''name'');

elem.appendChild(texto);

elem.appendChild(field);

frm.appendChild(elem);


elem = document.createElement(''P'');

field = document.createElement(''INPUT'');

field.setAttribute(''value'' ,''发送'');

field.type =''submit'';

elem.appendChild(field);

frm .appendChild(elem);


document.getElementById(''''')。appendChild(f rm);

}

< / script>

< button onclick =" go()"> GO< /按钮>

< div id =" here">< / div>


-

Stephane Moriaux et son [moins] vieux Mac


Hello,

How do I create a form without using document.write() which opens a
new window?

I imagine it has to do with using a <SPAN ID=''idvalue'' etc element and
document.getElementById("idvalue").innerHTML but not clear how to do
it...

This is how I have done it at the moment ...

document.write("<form action =''http://website/path/formmail-nms.cgi''
method=''post''>");
document.write("<input type =''hidden'' name =''slidervalues'' value=''" +
str_questions + "''>");
document.write("<input type =''hidden'' name =''recipient'' value
=''extraemails''>");
document.write("<input type =''submit'' value=''send''
onlick-''sendslidervalues''>");
document.write("</form>");

Cheers

Geoff

解决方案


"Geoff Cox" <ge*******@notquitecorrectfreeuk.com> wrote in message
news:kn********************************@4ax.com...

Hello,

How do I create a form without using document.write() which opens a
new window?

I imagine it has to do with using a <SPAN ID=''idvalue'' etc element and
document.getElementById("idvalue").innerHTML but not clear how to do
it...

This is how I have done it at the moment ...

document.write("<form action =''http://website/path/formmail-nms.cgi''
method=''post''>");
document.write("<input type =''hidden'' name =''slidervalues'' value=''" +
str_questions + "''>");
document.write("<input type =''hidden'' name =''recipient'' value
=''extraemails''>");
document.write("<input type =''submit'' value=''send''
onlick-''sendslidervalues''>");
document.write("</form>");
not sure I follow the question so far. Why do you need to create the form
client side ?

Cheers

Geoff



On Sat, 10 Sep 2005 14:21:41 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:


"Geoff Cox" <ge*******@notquitecorrectfreeuk.com> wrote in message
news:kn********************************@4ax.com.. .

Hello,

How do I create a form without using document.write() which opens a
new window?

I imagine it has to do with using a <SPAN ID=''idvalue'' etc element and
document.getElementById("idvalue").innerHTML but not clear how to do
it...

This is how I have done it at the moment ...

document.write("<form action =''http://website/path/formmail-nms.cgi''
method=''post''>");
document.write("<input type =''hidden'' name =''slidervalues'' value=''" +
str_questions + "''>");
document.write("<input type =''hidden'' name =''recipient'' value
=''extraemails''>");
document.write("<input type =''submit'' value=''send''
onlick-''sendslidervalues''>");
document.write("</form>");
not sure I follow the question so far. Why do you need to create the form
client side ?



Zoe,

I have a set of slider values in array which I want to pass on to the
formmail-nms.cgi script so my idea is to put them into a form with a
submit button etc... is there a better way?

Cheers

Geoff




Cheers

Geoff




Geoff Cox wrote:

Hello,

How do I create a form without using document.write() which opens a
new window?



all as to write in a popup you can use same way
that''s to say : not that you use

mytext = ''<form action="page.htm" method="get">'';
mytext += ''<h2>some title<\/h2>'';
mytext += ''<p>Name : <input type=text name="name">'';
mytext += ''<p>First name : <input type=text name="Fname">'';
mytext += ''<p>Name : <input type=submit value="Send">'';
mytext += ''<\/form>'';

then at choice :

truc=window.open();
with(truc){open();write(mytext);close();}

or

document.geElementById(''here'').innerHTML = mytext;

more elegant way is to use nodes of DOM

<script type="text/javascript">
function go() {
var frm = document.createElement(''FORM'');
frm.setAttribute(''id'',''myForm'');
frm.setAttribute(''name'',''myForm'');
frm.setAttribute(''action'',''page.htm'');

var elem = document.createElement(''H2'');
elem.innerHTML=''some title'';
frm.appendChild(elem);

elem = document.createElement(''P'');
var texto = document.createTextNode(''Name : '');
var field = document.createElement(''INPUT'');
field.setAttribute(''name'',''name'');
elem.appendChild(texto);
elem.appendChild(field);
frm.appendChild(elem);

elem = document.createElement(''P'');
field = document.createElement(''INPUT'');
field.setAttribute(''value'',''send'');
field.type=''submit'';
elem.appendChild(field);
frm.appendChild(elem);

document.getElementById(''here'').appendChild(frm);
}
</script>
<button onclick="go()">GO</button>
<div id="here"></div>

--
Stephane Moriaux et son [moins] vieux Mac


这篇关于在同一页面上创建表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆