您将如何获得文本框值并在同一页面上打印 [英] How will you get a text box value and print on the same page

查看:64
本文介绍了您将如何获得文本框值并在同一页面上打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框和一个提交按钮.我想打印在文本框中输入的值并打印在同一页上.我正在使用外部文件

I have a text box and a submit button . I want to print the value entered in a text box and print on the same page. I am calling the javascript file using an external file

推荐答案

调用javascript文件,这并不困难.处理该按钮的客户端单击事件,检索文本框的值,然后将其输出.您在此过程的哪一部分遇到困难?到目前为止,您尝试了什么?

It isn''t that difficult. Handle the client-side click event for the button, retrieve the value of the textbox, output it. What part of this process are you having difficulty with? What have you tried so far?

function OnSubmit()
{
   var txt = document.getElementById("textbox");
   alert(txt.innerText);
}


jQuery是您的朋友 http://api.jquery.com/category /events/ [ ^ ]

查看演示 http://api.jquery.com/change/ [
jQuery is your friend http://api.jquery.com/category/events/[^]

Look at the demo http://api.jquery.com/change/[^]

Regards
Espen Harlinn


这篇关于您将如何获得文本框值并在同一页面上打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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