cari

Tindakan Borang HTML

Sep 04, 2024 pm 04:44 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

In HTML, we have using a form tag to navigate the web pages. The tag which consists of action, methods and values attribute in the HTML. The Method attributes which specified how to send the data from one page to another page after validation. Generally, we have sent the form data through URL Methods like get and post. Form Tag in HTML is used for web pages that are the user to enter data it will move to server validation, it can resemble the pages because the server validates the user request. Even though all the html tags like checkboxes, radio buttons, text fields, etc..those fields will use the form to validate purpose in the backend.

Form Action in HTML

Whenever we enter the data in the view page(user) using a browser, it will move to the backend. The HTML action needs some attributes to specify the request if; suppose we have a JSP page with servlet; the user enters the data in frontend those datas which handles using the form known as form data. The value of an HTML action attribute is nothing but a URL; there is no default value of HTML action attributes.

Syntax:


………..Some html tags and user defined values…..

The above syntax is the basics for creating the forms in html. It is the flow of navigating the web pages.

Examples of HTML Form Action

Following are the example of html form action as given below:

Example #1

Code:


First name:
Last name:

Output:

Tindakan Borang HTML

Code Explanation: In the above example, we will use the action page as JSP; after the user entered the data, it will validate from the jsp page and display the output on the browser screen.

Note: Whenever we use jsp, we need application servers like tomcat, jetty, WebLogic, etc.

Example #2

Code:


First name:
Last name:

<script> function myFunction() { document.getElementById("form1").action = "https://cdn.educba.com/fisrst.jsp"; document.getElementById("demo").innerHTML = "The value of the action attribute was changed to /fisrst.jsp."; } </script>

Output:

Tindakan Borang HTML

Code Explanation: In the above example, we will use the javascript function for navigating the web pages or not. If we use the javascript function in the HTML, it will more use of validation, alert the messages, and whatever the user-customized information is to be validated by the scripts. We use the DOM object that is the Document Object Model, a model for accessing the documents and is a platform and language-neutral interfaces that allow programs to dynamically access and update the content structure and styles of the user-defined datas.

Example #3

Code:

<style>
body {
color: yellow;
height: 100vh;
background:Green;
text-align: center;
}
input {
width: 315px;
padding: 8px;
background: Green;
border-radius: 20px;
}
::placeholder {
color: Green;
}
.btn {
background:Green;
height: 200px;
width: 300px;
}
</style>

First name:
Last name:

<script> function myFunction() { document.getElementById("form1").action = "https://cdn.educba.com/fisrst.jsp"; document.getElementById("demo").innerHTML = "The value of the action attribute was changed to /fisrst.jsp."; } </script>

Output:

Tindakan Borang HTML

Code Explanation: The above example is the basic purpose; whenever we develop the web page, it will need to satisfy the user requirements and be more attractive on the user side. Only the user will be more interested in using our Applications. So the above example, we use CSS Style in the form page is one of the more attractive and interacts with the user side.

Send Emails Using HTML Forms

It is one of the best features for web developers by using the browsers to allow them to route the form directly to a user email address after submission and is one of the ideas, but the reason is that if the browsers allowed emailing directly from the web form page that also will reveal the visitor’s email address directly, it also affects the users data. The hacker can collect the user information easily from the email address of the user web page and then spam it.

In order to protect the web users, no client-side language can send an email directly without the user interventions. We can set the form action field like as “mailto”, using this case, the browser invokes the mail client to send the form submission to the particular email address, which is to be user-specified.

Example:


Generally, HTML form has two parts: the user point of view, that is, the front end form that you see in the browser screen, and the second is a back-end script that runs on the web servers. Your web browsers display the form using some HTML codes; after submitting the form, the browser sends the information whatever you submitted data in the form to the backend.

Some links we have defined in the above examples.


The browser will pick the URL mentioned in the form of action attributes and send the data to that URL, using web servers passes the form submission data to the script in the action URL(example.jsp). Now the backend scripts also send emails after submitted for the form data to the database.

Send Mail Using jsp

Here we discuss how to send mail using jsp:






<center>
<h1 id="Send-Email-using-JSP">Send Email using JSP</h1>
</center>
<p align="center">

</p>

Output:

Tindakan Borang HTML

Penjelasan Kod: Dalam contoh program di atas, kami telah mencatat maklumat menggunakan beberapa pelayan aplikasi untuk menjalankan kod di atas; ia akan menghantar e-mel menggunakan program jsp.

Kesimpulan

Dalam teknologi terkini, kami mempunyai banyak ciri untuk mengurangkan beban kerja dan mempunyai tanggungjawab untuk mengemas kini pengetahuan dari hari ke hari. Perkara yang sama dalam HTML dan HTML5 ialah versi terkini HTML mempunyai ciri yang sama tetapi beberapa langkah lagi untuk keserasian penyemak imbas. Kita perlu menyemak bila-bila masa kita menggunakan HTML dan HTML 5 disokong oleh pelayar atau tidak. Kami mempunyai banyak ciri dalam HTML, seperti yang dibincangkan kemudian.

Atas ialah kandungan terperinci Tindakan Borang HTML. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!

Kenyataan
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Bagaimana anda memasukkan gambar ke dalam halaman HTML?Bagaimana anda memasukkan gambar ke dalam halaman HTML?May 04, 2025 am 12:02 AM

Toinsertanimageintoanhtmlpage, usethetagwithsrcandaltattribut

Tujuan HTML: Membolehkan Pelayar Web memaparkan kandunganTujuan HTML: Membolehkan Pelayar Web memaparkan kandunganMay 03, 2025 am 12:03 AM

Tujuan utama HTML adalah untuk membolehkan penyemak imbas memahami dan memaparkan kandungan web. 1. HTML mentakrifkan struktur laman web dan kandungan melalui tag, seperti, ke, dan sebagainya. 2. HTML5 meningkatkan sokongan multimedia dan memperkenalkan dan tag. 3.HTML menyediakan elemen borang untuk menyokong interaksi pengguna. 4. Mengoptimumkan kod HTML boleh meningkatkan prestasi laman web, seperti mengurangkan permintaan HTTP dan memampatkan HTML.

Mengapa tag HTML penting untuk pembangunan web?Mengapa tag HTML penting untuk pembangunan web?May 02, 2025 am 12:03 AM

Htmltagsareessentialforwebdevelopmentastastheystructureandhancewebpages.1) theDefinelayout, semantik, dan interactivity.

Terangkan kepentingan menggunakan gaya pengekodan yang konsisten untuk tag dan atribut HTML.Terangkan kepentingan menggunakan gaya pengekodan yang konsisten untuk tag dan atribut HTML.May 01, 2025 am 12:01 AM

Gaya pengekodan HTML yang konsisten adalah penting kerana ia meningkatkan kebolehbacaan, kemampuan dan kecekapan kod. 1) Gunakan tag dan atribut huruf kecil, 2) Pastikan lekukan yang konsisten, 3) Pilih dan tentukan sebut harga tunggal atau berganda, 4) Elakkan mencampurkan gaya yang berbeza dalam projek, 5) Gunakan alat automasi seperti Prettier atau Eslint untuk memastikan konsistensi dalam gaya.

Bagaimana untuk melaksanakan Carousel Multi-Project di Bootstrap 4?Bagaimana untuk melaksanakan Carousel Multi-Project di Bootstrap 4?Apr 30, 2025 pm 03:24 PM

Penyelesaian untuk melaksanakan Carousel Multi-Project dalam Bootstrap4 Melaksanakan Carousel Multi-Project di Bootstrap4 bukanlah tugas yang mudah. Walaupun bootstrap ...

Bagaimanakah laman web rasmi DeepSeek mencapai kesan menembusi acara tatal tetikus?Bagaimanakah laman web rasmi DeepSeek mencapai kesan menembusi acara tatal tetikus?Apr 30, 2025 pm 03:21 PM

Bagaimana untuk mencapai kesan penembusan peristiwa menatal tetikus? Apabila kami melayari web, kami sering menghadapi beberapa reka bentuk interaksi khas. Sebagai contoh, di laman web rasmi DeepSeek, � ...

Cara mengubahsuai gaya kawalan main balik video HTMLCara mengubahsuai gaya kawalan main balik video HTMLApr 30, 2025 pm 03:18 PM

Gaya kawalan main balik lalai video HTML tidak dapat diubahsuai secara langsung melalui CSS. 1. Buat kawalan tersuai menggunakan JavaScript. 2. Mencantikkan kawalan ini melalui CSS. 3. Pertimbangkan keserasian, pengalaman pengguna dan prestasi, menggunakan perpustakaan seperti video.js atau PLYR dapat memudahkan proses.

Masalah apa yang akan disebabkan oleh menggunakan Pilih asli di telefon anda?Masalah apa yang akan disebabkan oleh menggunakan Pilih asli di telefon anda?Apr 30, 2025 pm 03:15 PM

Masalah yang berpotensi dengan menggunakan pilihan asli pada telefon bimbit semasa membangunkan aplikasi mudah alih, kami sering memenuhi keperluan untuk memilih kotak. Biasanya, pemaju ...

See all articles

Alat AI Hot

Undresser.AI Undress

Undresser.AI Undress

Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover

AI Clothes Remover

Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool

Undress AI Tool

Gambar buka pakaian secara percuma

Clothoff.io

Clothoff.io

Penyingkiran pakaian AI

Video Face Swap

Video Face Swap

Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Alat panas

Hantar Studio 13.0.1

Hantar Studio 13.0.1

Persekitaran pembangunan bersepadu PHP yang berkuasa

Dreamweaver Mac版

Dreamweaver Mac版

Alat pembangunan web visual

VSCode Windows 64-bit Muat Turun

VSCode Windows 64-bit Muat Turun

Editor IDE percuma dan berkuasa yang dilancarkan oleh Microsoft

EditPlus versi Cina retak

EditPlus versi Cina retak

Saiz kecil, penyerlahan sintaks, tidak menyokong fungsi gesaan kod

Muat turun versi mac editor Atom

Muat turun versi mac editor Atom

Editor sumber terbuka yang paling popular