需要帮助在JS中预填充输入字段 [英] Need help prefilling input field usin JS
问题描述
我以为我已经弄明白了,并且能够在服务器上用PHP做到这一点,但是,我如何使用客户端中的JavaScript在
预填充带有cookie值的输入字段 - 页面?
谢谢,
Don
----------- ==发表于Newsfeed.Com - 未经审查的Usenet新闻== ----------
http ://www.newsfeed.com 全球排名第一的新闻组服务!
----- =超过100,000个新闻组 - 无限快速下载 - 19台服务器= ---- -
" Don" < no@adr.com>在消息中写道
news:tu ******************************** @ 4ax.com ...我以为我已经弄明白了,并且已经能够在PHP上以
服务器执行此操作,但是,如何使用cookie值预填充输入字段
客户端页面中的JavaScript?
谢谢,
Don
这会有帮助吗?请注意自动换行。
< html>
< head>
< title> coookie.htm< / title>
< script type =" text / javascript">
function coookie(){
document.getElementById(" ; data。value = document.cookie;
}
< / script>
< / head>
< body onload =" coookie()">
< form>
< input type =" text"名称= QUOT;数据" size =" 100">
< / form>
< / body>
< / html>
2004年12月20日星期一16:37:40 GMT,McKirahan <氖** @ McKirahan.com>写道:
" Don" < no@adr.com>在消息中写道
新闻:tu ******************************** @ 4ax.com ..。< blockquote class =post_quotes>我以为我已经搞清楚了,并且已经能够在PHP上
服务器,但是,我如何prefill在
客户端页面中使用JavaScript的带有cookie值的输入字段?
谢谢,
Don
这会有帮助吗?注意自动换行。
< html>
< head>
< title> coookie.htm< / title>
< script type = " text / javascript">
function coookie(){
document.getElementById(" data")。value = document.cookie;
}
< / script> ;
< / head>
< body onload =" coookie()">
< form>
< input type =" text"名称= QUOT;数据" size =" 100">
< / form>
< / body>
< / html>
感谢McKirahan。我试试看。很高兴知道你在外面帮忙。
非常感谢,祝节日快乐。
Don
----------- ==通过Newsfeed.Com发布 - 未经审查的Usenet新闻== ----------
http://www.newsfeed.com 世界排名第一的新闻组服务!
----- =超过100,000个新闻组 - 无限制快速下载 - 19个服务器= -----
2004年12月20日星期一16:37:40 GMT,McKirahan <氖** @ McKirahan.com>写道:
" Don" < no@adr.com>在消息中写道
新闻:tu ******************************** @ 4ax.com ..。< blockquote class =post_quotes>我以为我已经搞清楚了,并且已经能够在PHP上
服务器,但是,我如何prefill在
客户端页面中使用JavaScript的带有cookie值的输入字段?
谢谢,
Don
这会有帮助吗?注意自动换行。
< html>
< head>
< title> coookie.htm< / title>
< script type = " text / javascript">
function coookie(){
document.getElementById(" data")。value = document.cookie;
}
< / script> ;
< / head>
< body onload =" coookie()">
< form>
< input type =" text"名称= QUOT;数据" size =" 100">
< / form>
< / body>
< / html>
McKirahan,
我尝试了你的建议,它对IE很有用。但似乎无法获得任何预付费用
Netscape。 Netscape不允许预填充吗?
谢谢,
Don
----------- ==通过Newsfeed.Com发布 - 未经审查的Usenet新闻== ----------
http://www.newsfeed.com 世界排名第一的新闻组服务!
----- =超过100,000个新闻组 - 无限快速下载 - 19台服务器= -----
I thought I had this figured out, and have been able to do it in PHP on the server, but, how do I
prefill an input field with a cookie value using JavaScript in a client-side page?
Thanks,
Don
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
"Don" <no@adr.com> wrote in message
news:tu********************************@4ax.com...I thought I had this figured out, and have been able to do it in PHP on the server, but, how do I prefill an input field with a cookie value using JavaScript in a client-side page?
Thanks,
Don
Will this help? Watch for word-wrap.
<html>
<head>
<title>coookie.htm</title>
<script type="text/javascript">
function coookie() {
document.getElementById("data").value = document.cookie;
}
</script>
</head>
<body onload="coookie()">
<form>
<input type="text" name="data" size="100">
</form>
</body>
</html>
On Mon, 20 Dec 2004 16:37:40 GMT, "McKirahan" <Ne**@McKirahan.com> wrote:
"Don" <no@adr.com> wrote in message
news:tu********************************@4ax.com.. .I thought I had this figured out, and have been able to do it in PHP on
the server, but, how do Iprefill an input field with a cookie value using JavaScript in a
client-side page?
Thanks,
Don
Will this help? Watch for word-wrap.
<html>
<head>
<title>coookie.htm</title>
<script type="text/javascript">
function coookie() {
document.getElementById("data").value = document.cookie;
}
</script>
</head>
<body onload="coookie()">
<form>
<input type="text" name="data" size="100">
</form>
</body>
</html>
Thanks McKirahan. I''ll give it a try. It sure is nice knowing you''re out there to help out.
Thanks much, and have a Happy Holiday Season.
Don
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
On Mon, 20 Dec 2004 16:37:40 GMT, "McKirahan" <Ne**@McKirahan.com> wrote:
"Don" <no@adr.com> wrote in message
news:tu********************************@4ax.com.. .I thought I had this figured out, and have been able to do it in PHP on
the server, but, how do Iprefill an input field with a cookie value using JavaScript in a
client-side page?
Thanks,
Don
Will this help? Watch for word-wrap.
<html>
<head>
<title>coookie.htm</title>
<script type="text/javascript">
function coookie() {
document.getElementById("data").value = document.cookie;
}
</script>
</head>
<body onload="coookie()">
<form>
<input type="text" name="data" size="100">
</form>
</body>
</html>
McKirahan,
I tried your suggestion, and it works just great with IE. But can''t seem to get any prefill with
Netscape. Doesn''t Netscape allow prefills?
Thanks,
Don
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
这篇关于需要帮助在JS中预填充输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!