在页面之间传递输入值。 [英] Passing input values between pages.

查看:63
本文介绍了在页面之间传递输入值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在HTML论坛上被引用,因为我被告知答案在于javascript。


我确定这应该很简单但是我我真的很想弄清楚这一点。我没有访问服务器但是正在开发一个站点,我需要将信息从一个表单上的输入框传递到另一个表单上的一段文本。


最简单的例子我可以想到将是第一页带有标题和姓氏的输入框,页面将在同一个浏览器会话中,我希望它都是客户端。


[ HTML]< head>


< title>测试< / title>


< table>

< tr>

< td>标题:< / td>

< td>< p>

< input name =" Title"类型= QUOT;文本" ID = QUOT;标题"大小= QUOT; 20" maxlength =" 4">

< / p> < / td>

< / tr>

< tr>


< td>姓:< / td>

< td>< input name =" Surname"类型= QUOT;文本" ID = QUOT;姓"大小= QUOT 35 QUOT; maxlength =" 50"< / td>

< / tr>


< td><输入名称= QUOT;复位" type ="重置"

value =" Clear Form" />

< a href =" Test_Page2.html"> Next< / a>

< / body>

< / html>

[/ HTML]


和第二页,然后会显示文本中的值。


[HTML]< head>


< title> Untitled Document< / title>

< / head>


< body>

你好

< / body>


< / html> ;

[/ HTML]

因此,如果我打开第一页并放入Mr和Smith,第二页上写着Hello Mr Smith


上面例子中两个页面上的javascipt是​​什么?


谢谢。

解决方案

嗨...


让我给你的想法:


你可以将你的价值追加到你想要调用的网址......这样网址就像:

展开 | 选择 | Wrap | 行号


不,我不熟悉Javascript,只是习惯了网络编辑创建的HTML。如果我在使用表单和VB的MS Access中执行此操作,我可以轻松搞定。


我知道网上有很多例子,但它们看起来很复杂而且我' 我只是没有得到它!我们可以一步一步吗?


您是说我将链接A href代码更改为:


[HTML ]< a href =" Test_Page2.html?Title = val1& Surname = val2"> Nex t< / a> [/ HTML]


继承了查询字符串第二页上的网址 - 尽管如此,它包含标题的文本。和Suraname而不是先生和先生的价值观。 Smith。


完全:) ...现在我们需要一个为你构建查询字符串的javascript;)

展开 | 选择 | Wrap | 行号

I''ve been referred here from the HTML forum as I''m told the answer lies in javascript.

I''m sure this should be simple enough but I''m really struggling to get my mind around this. I don''t have access to a server but am developing a site and I need to pass information from input boxes on one form to a paragraph of text on another.

The simplest example I could think of would be a first page with input boxes for Title and Surname, The pages will be within the same browser session and I would like it to all be client side.

[HTML]<head>

<title>Test</title>

<table>

<tr>
<td>Title:</td>
<td><p>
<input name="Title" type="text" id="Title" size="20" maxlength="4">
</p> </td>
</tr>
<tr>

<td>Surname:</td>
<td><input name="Surname" type="Text" id="Surname" size="35" maxlength="50"></td>
</tr>


<td><input name="Reset" type="Reset"
value="Clear Form" />
<a href="Test_Page2.html">Next</a>
</body>
</html>
[/HTML]

and a second page which would then show the values in text.

[HTML]<head>

<title>Untitled Document</title>
</head>

<body>
Hello
</body>

</html>
[/HTML]
So if I open the first page and put in Mr and Smith the second page reads "Hello Mr Smith"

What would the javascipt be on the two pages in the example above?

Thanks.

解决方案

hi ...

let me give you an idea:

you may append your values to the url you want to call ... so that the url looks like:

Expand|Select|Wrap|Line Numbers


No, i''m not used to Javascript and only just getting used to the HTML that web editors create. If I was doing this in MS Access using forms and VB I would be OK to muddle through.

I know there are a lot of examples on the net but they seem complicated and I''m just not "getting it"! Can we take it a step at a time?

Are you saying I change the link A href code to something like:

[HTML]<a href="Test_Page2.html?Title=val1&Surname=val2">Nex t</a>[/HTML]

which carries forward a querystring on the url on the second page - although with the above it contains the text of "Title" and "Suraname" and not the values of Mr & Smith.


exactly :) ... now we need a javascript that builds the querystring for you ;)

Expand|Select|Wrap|Line Numbers


这篇关于在页面之间传递输入值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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