Day: 25 April 2021

CodingLearnNew
MailTo Links

Getting Started with MailTo

Ever wonder how you click on a link and like magic it opens Outlook and has an email formatted with the ToSubject and a message already filled in?

Below we provide a few details on how just to do that.

The Code

This opens the user’s default mail program, creates a new message with the TO field already filled out.

<a href="mailto:test@someone.com">Email Us</a>

Pre-filled Address and Subject Line

This opens the user’s default mail program, creates a new message with the TO field already filled out. We also fill the SUBJECT line.

 

<a href="mailto:test@someone.com?subject=New Mail">Email Us</a>

Pre-filled Address, Subject Line and message (body)

This opens the user’s default mail program, creates a new message with the TO field already filled out. We also fill the SUBJECT line and add in a message (body) of the email.

<a href="mailto:test@someone.com?subject=New Mail&body=Hi">Email Us</a>
LearnNew
What is JavaScript (JS)

JavaScript is one of the most popular programming languages for the Web (it is said 95.2% of all websites use JavaScript). JavaScript can change and update both HTML and CSS in addition to a whole host of other features.

JavaScript (or JS from here on) uses many data types, below is some of the most important.

JavaScript Variables

Variables are essentially containers for storing data values.

Below we use the variables are a, b, c

var a=10;
var b=5;
var c=a + b;
What you can expect is:
  • a stores the value of 10
  • b stores the value of 5
  • c stores the value of 15 (a + b)

JavaScript Strings

Strings store text, the text within these should not be confused with other variable types (numbers, etc.). You can use single or double-quotes.

1
2
var bike = "Canyon"; var bike = 'Canyon';

If you are looking to determine the length of a string, you can use JavaScripts built-in property length.

1
2
3
4
var bike = "Canyon";
var bikeln = bike.length;
Result: 6

JavaScript Objects

Objects are variables, but, they can contain many values within one variable.

Below we assign a simple value (Aeroad) to our variable named bike:

1
var bike = "Aeroad";

Below we assign many values (Aeroad, stealth, large) to our variable named bike:

1
var bike = {model:"Aeroad", color:"stealth", size:"large"};

JavaScript Arrays

Arrays are used to store multiple values in a single variable.

1
var bike = ["Canyon", "Trek", "BMC"];

JavaScript Functions

A function is a block of code that can be called (invokes) from another function or within the code.

It is designed to perform a set task and normally will return something.