从prompt()返回值? [英] returning value from prompt() ??

查看:108
本文介绍了从prompt()返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。这是我们在html文件中的内容。


< form .....


< input type = button名称= QUOT;注释"的onclick = QUOT;提示(''输入评论'',''

'')" >


无论如何都要从上面的声明

中将提示返回的值转换为下面语句的值?


< input type = hidden name =" comment_text" value = ???? >

我们希望用户点击评论按钮,有另一个窗口

popup他们输入他们的评论,然后拿评论文本和

将它附加到隐藏语句的value参数。


有可能吗?


非常感谢。


John Edgar

Hello everyone. here''s what we have in an html file.

<form .....

<input type=button name="comment" onclick=" prompt(''enter comment'',''
'' )" >

Is there anyway to get the value returned from the prompt in the statement
above, into the value of the statement below ?

<input type=hidden name="comment_text" value = ???? >
We would like the user to click the "comment" button, have another window
popup where they enter their comment, and then take the comment text and
append it to the value parameter of the hidden statement.

Is it possible?

Thanks very much.

John Edgar

推荐答案

" JSE" <乔** @ nospam.conwayinfo.ca>在消息中写道

news:ayu%b.621790
"JSE" <jo**@nospam.conwayinfo.ca> wrote in message
news:ayu%b.621790


X%5.448756@pd7tw2no ...
X%5.448756@pd7tw2no...
大家好。这是我们在html文件中的内容。

< form .....

< input type = button name =" comment"的onclick = QUOT;提示(''输入
comment'','''')" >


您需要将提示的返回存储在一个变量中,或者立即用它做一些

,否则返回值会丢失。

提示符(''Hello'','''');是没用的。

p =提示(''你好'','''');将任何用户类型保存到变量p中以进一步处理。

< input type = hidden name =" comment_text" value = ???? >

我们希望用户点击评论。按钮,有另一个窗口弹出窗口,他们输入他们的注释,然后获取注释文本并将其附加到隐藏语句的value参数。
Hello everyone. here''s what we have in an html file.

<form .....

<input type=button name="comment" onclick=" prompt(''enter comment'','' '' )" >
You need to store the return of the prompt in a variable or do something
with it immediately, otherwise the return value gets lost.
prompt(''Hello'',''''); is useless.
p=prompt(''Hello'',''''); saves whatever user types into variable p for further
processing.
<input type=hidden name="comment_text" value = ???? >

We would like the user to click the "comment" button, have another window
popup where they enter their comment, and then take the comment text and
append it to the value parameter of the hidden statement.




重写按钮如下:

< input type =" button" name =" comment"

onclick =" var p = prompt(''enter comment'',''''); if(p)this.form.comment_text

+ = p; >


如果你想首先检查一下p(或者真的想要一个窗口而不是一个愚蠢的提示的b $ b),它可能是最好将整个代码从

onclick转移到一个单独的函数中。

HTH

Ivo



Rewrite the button as follows:
<input type="button" name="comment"
onclick=" var p = prompt(''enter comment'',''''); if (p) this.form.comment_text
+= p; ">

If you want to do some checking on p first (or really want a window instead
of a silly prompt), it is perhaps better to take the whole code out of the
onclick into a separate function.
HTH
Ivo


JSE写道:
JSE wrote:
大家好。这是我们在html文件中的内容。

< form .....

< input type = button name =" comment"的onclick = QUOT;提示(''输入评论'',''
'')" >

无论如何从上面的声明中获取从提示返回的值到下面的语句的值?

<输入类型= hidden name =" comment_text" value = ???? >

我们希望用户点击评论按钮,有另一个窗口弹出窗口,他们输入他们的评论,然后取评论文本并将其附加到隐藏语句的value参数。

有可能吗?

非常感谢。

John Edgar
Hello everyone. here''s what we have in an html file.

<form .....

<input type=button name="comment" onclick=" prompt(''enter comment'',''
'' )" >

Is there anyway to get the value returned from the prompt in the statement
above, into the value of the statement below ?

<input type=hidden name="comment_text" value = ???? >
We would like the user to click the "comment" button, have another window
popup where they enter their comment, and then take the comment text and
append it to the value parameter of the hidden statement.

Is it possible?

Thanks very much.

John Edgar




< input type =" button"名称= QUOT;注释" onclick =" comment_text.value =

提示(''输入评论'')">


Mick




<input type="button" name="comment" onclick="comment_text.value=
prompt(''enter comment'')">

Mick



这篇关于从prompt()返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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