An email link can be added to web pages, too. When people click on this email link, their Email software will start up. In the "To" box of the email software, your email address will appear. The code for an email link is this:
<A HREF = "MailTo:online@homeandlearn.co.uk">Email us</A>
Notice that the link is the HREF type. After the equals sign you have this:
Mailto:
Mailto is all one word, and is followed by a colon. Then you put your email address after the colon, without typing a space. You then type a right angle bracket ( > ) before typing the text you want people to click on to send you an email. The Anchor closing tag </A> finishes it all off.
And that's it for email address - quite simple!
Try the email code out in a web page, save your work and see what happens when you view the web page and click the email link.
There is, however, a big danger to using an email link in your web pages: spammers have written programmes called "bots" to crawl the internet looking for MailTo. If the "bot" finds it, your email address will be harvested. In short, it's better not to use the email tag. Much better is to use scripting for your email addresses. For example, he's some JavaScript that does the job better, as the spammers' automated "bots" can't read it:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
document.write("<P></P><Center><H1>Contact Me</H1></Center>")
document.write("<P align = Center>Click below to send me an email</P>")
var atSign = "@"
var firstPart = "onl"
var ispP1 = "ine"
var ispP2 = "homeand"
var ispP3 = "learn.co.uk"
var wholeAddress = firstPart + ispP1 + atSign + ispP2 + ispP3
var mToPart1 = "mai"
var mToPart2 = "lto:"
var mt = mToPart1 + mToPart2
var hrefP1 = "<a href= " + mt + wholeAddress + ">Click here to email me</a>"
document.write("<Center>" + hrefP1 + "</Center>")
</SCRIPT>
You don't need to be able to understand all of the above code. But notice how the email address is chopped into pieces with these lines:
var atSign = "@"
var firstPart = "onl"
var ispP1 = "ine"
var ispP2 = "homeand"
var ispP3 = "learn.co.uk"
The address is them reassembled later and written out
No comments:
Post a Comment