使用window.location时,不保留在文本框中输入的值 [英] While using window.location the value entered in text box is not retained

查看:89
本文介绍了使用window.location时,不保留在文本框中输入的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这里我试图用新网址填充页面,并在文本框中输入值。

这是php代码名为example.php

Hi,

Here am trying to populate the page with new url, with the value that is being entered in the text box.
this is the php code called example.php

展开 | 选择 | Wrap | 行号

推荐答案

@sarega


getElementById()写有一个小的g,但为什么这么复杂ated?只需使用< input>的默认值属性回显服务器脚本中的值(< input ... value =" default" />)。当你有一个表单时,你不需要用location.href重新加载页面,这就是提交按钮的用途(除了一些特殊情况)。
@sarega
getElementById() is written with a small "g", but why so complicated? just echo out the value in your server script using the default value attribute for <input> (<input ... value="default"/>). when you have a form, you don''t need to reload the page with location.href, that''s what the submit button is for (except for some special cases maybe).


我希望将该值用于进一步处理。那么如何检索值的值?
I want that value to be used for further processing. So how do i retrieve the value of value??


Javascript处理或PHP处理?
Javascript processing or PHP processing?


这篇关于使用window.location时,不保留在文本框中输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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