Collecting info HTML/JavaScript

HTML Scripts & Tutorials. HyperText Markup Language
Post Reply
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

Collecting info HTML/JavaScript

Post by dzcadii » Sun Mar 01, 2015 6:23 pm

Here is a simple way to collect information from a link (<a href></a>).

This example could be used in changing a users email address:

**Note: There is no error checking in this example

Code: Select all

<!-- File name would be index.html -->
<title>Change My Email</title>
<script language="javascript">
function change_email(){
var email1=prompt("Please enter in your new email address!");
var email2=prompt("Please verify your new email address!");

if(email1 == "" || email2 == "" || email2 != email1){
alert("Do not leave your email address blank!");
<a href="javascript:change_email();">Change my email</a>

Post Reply