Cách Lấy Giá Trị Từ Text Box Bằng Javascript | Vinh Pham

Standard

Posted by

Vinh Pham

Posted on

28/10/2010

Posted under

Javascript

Comments

Leave a comment Cách lấy giá trị từ text box bằng javascript

<html>

<head>

<script type=”text/javascript”>

function gettext(){ var s = document.getElementById(“txtname”).value; alert(s); }

}

</script>

</head>

<body>

<input type=”text” id=”txtname” /> <input type=”button” value=”click here” onclick=”gettext()”/>

</body>

</html>

  • document.getElementById(“txtname”).value: lấy giá trị chúng ta sử dụng cấu trúc như sau document.getElementbyId(“”).value – bên trong giấu “” là ID element ta cần lấy ở đây là txtname;
  • alert(): xuất ra bảng thông báo

Share this:

  • Facebook
  • X
Like Loading...

Related

Post navigation Cấu trúc hàm trong javascrip Cách tạo một object trong javascript

Leave a comment Cancel reply

Δ

Recent Posts
  • Áp dụng ElasticSearch vào ứng dụng Ruby on Rails 28/03/2015
  • IIS AppPoolIdentity and file system write access permission 09/05/2014
  • Adding Application Notifications With Kendo UI Core [tuts+] 06/05/2014
  • Streaming Video in Android Apps [Tuts+] 23/04/2014
  • Revitalizing the Rich Client [SignalR – Chapter 1] 09/10/2013
  • Mobile First With Bootstrap 3 [Tuts+] 01/10/2013
  • Understanding Design Patterns in JavaScript 18/02/2013
  • Tutorial: Getting Started with SignalR (C#) 31/01/2013
  • A Peek at Internet Explorer’s Developer Tools 31/01/2013
  • From Scrum to Lean 30/01/2013
  • Visual Studio: Web Dev Bliss 30/01/2013
  • Building a Scalable App With Backbone.js 22/10/2012
  • Web developers are software engineers, too 10/10/2012
  • Submit A Form Without Page Refresh using jQuery 08/10/2012
  • How to Fix “HTTP Error 403.14 – Forbidden The Web server is configured to not list the contents of this directory” 05/10/2012
  • The Ins and Outs of WebMatrix: .NET Programming Using the Razor Syntax 05/10/2012
  • Node.js Step by Step: Introduction 05/10/2012
  • Build Your First JavaScript Library 05/10/2012
  • Building an ASP.NET MVC4 Application with EF and WebAPI 05/10/2012
  • 28 HTML5 Features, Tips, and Techniques you Must Know 15/06/2012
  • Part 3: Create a blog reader (Metro style apps using JavaScript and HTML) 10/06/2012
  • Part 2: Manage app lifecycle and state (Metro style apps using JavaScript and HTML) 10/06/2012
  • Part 1: Create a “Hello, world” app (Metro style apps using JavaScript and HTML) 10/06/2012
  • Phân trang bằng SQL 20/12/2011
  • JSON là gì?? 18/12/2011
  • RMI in Java Part 2 11/06/2011
  • RMI in Java Part 1 11/06/2011
  • Imagine cup 2011 01/12/2010
  • Web portal 29/11/2010
  • Code-First Development with Entity Framework 4 04/11/2010
  • Cách tạo một object trong javascript 01/11/2010
  • Cách lấy giá trị từ text box bằng javascript 28/10/2010
  • Cấu trúc hàm trong javascrip 27/10/2010
  • Sử dụng javascrip trong HTML 26/10/2010
  • Những điểm mới torng ASP.NET 4.0 (phần 3) 18/10/2010
  • ASP.NET MVC framework 17/10/2010
  • Những điểm mới trong ASP.NET 4.0(Phần II) 17/10/2010
  • Những điểm mới trong ASP.NET 4.0 (Phần I) 16/10/2010
  • Silverlight vs Adobe Flash (Flex) 12/10/2010
  • Tổng quan về SilverLight 12/10/2010
Recent Comments
Air Max 2009 on Silverlight vs Adobe Flash…
Rikk on How to Fix “HTTP Error 403.14…
ofir kenan on How to Fix “HTTP Error 403.14…
ofir kenan on How to Fix “HTTP Error 403.14…
Vinh Pham on Part 3: Create a blog reader (…
ASP.NET ASP.NET MVC Backbonejs HTML Java Javascript Nodejs SignalR Silverlight SQL Tools Uncategorized WebMatrix Windows 8 October 2010
M T W T F S S
123
45678910
11121314151617
18192021222324
25262728293031
Nov » vinhpt90@gmail.com

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Email Address:

Sign me up!

Join 7 other subscribers Page Views
  • 45,309 views
RSS
  • RSS - Posts
ads cpm Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use. To find out more, including how to control cookies, see here: Cookie Policy
  • Comment
  • Reblog
  • Subscribe Subscribed
    • Vinh Pham
    • Sign me up
    • Already have a WordPress.com account? Log in now.
    • Vinh Pham
    • Customize
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
%d

Từ khóa » Gán Giá Trị Cho Textbox Trong Javascript