Submit Your Article Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-02-2007, 08:24 AM
WebProWorld Pro
 
Join Date: Sep 2006
Posts: 142
optimalwebsite RepRank 1
Default Javascript email help required!!!

Hi all! I use the following Javascript snippets to protect my email address.

<script language=javascript>
<!--
var username = "email";
var hostname = "websiteaddress.co.uk";
var linktext = "Click here";
document.write("<a href=" + "mail" + "to:" + username +
"@" + hostname + ">" + linktext + "</a>")
//-->
</script

How do you modify this so that when it's clicked on it generates the email but with text in the content or title part of the email?! I'm really stuck, so any help appreciated!

Regards,


Joel
Reply With Quote
  #2 (permalink)  
Old 08-02-2007, 08:59 AM
sands's Avatar
WebProWorld Veteran
 
Join Date: Sep 2005
Location: Kerala, India
Posts: 395
sands RepRank 1
Default Re: Javascript email help required!!!

If you mean a subject and body text check out the code below:
Code:
<script language=javascript> 
<!-- 
var username = "email"; 
var hostname = "websiteaddress.co.uk"; 
var linktext = "Click here"; 
document.write("<a href='mailto:" + username + 
"@" + hostname + "?Subject=Subject goes here&Body=Text in the body of the mail!'>" + linktext + "</a>") 
//--> 
</script>
__________________
My Nook | My Biz | My Photos
Reply With Quote
  #3 (permalink)  
Old 08-02-2007, 11:55 AM
WebProWorld Pro
 
Join Date: Sep 2006
Posts: 142
optimalwebsite RepRank 1
Default Re: Javascript email help required!!!

Many thanks Sands!

I went to Kerala when I was 17 and rode an elephant! What a beautiful country.


Regards,


Joel
Reply With Quote
  #4 (permalink)  
Old 08-03-2007, 01:07 PM
WebProWorld Member
 
Join Date: Sep 2006
Location: Copenhagen
Posts: 60
Mads Dam RepRank 0
Default Re: Javascript email help required!!!

A small but further point. I noticed this in your code: "mail" + "to:"

Why not just "mailto:" instead..?

I know this is hardly an error (since both versions will work), but if you have more code like that it could be worth optimizing...

Another point, not so small: If you use javascript, then remember that it sometimes isn't available.
That could happen simply by raising the security-level of the browser (IE).
Or it could be caused by NoScript (Firefox). Or something else...

My point is: Offer people an alternative text explaining that they see nothing because javascript is off.
Otherwise they'll just see nothing, and won't even know that something was supposed to be present...

The alternative text could also be an image, displaying the email address so people at least could read it and enter it manually.
If javascript is on, this image would simply be covered and invisible.

In any case: don't assume that javascript always is available...
__________________
Photo + Graphic + Animation
www.madsdam.net
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email spam bots - display name vs. actual email address apalmer123@msn.com Web Programming Discussion Forum 27 12-14-2009 10:25 AM
Email (not address, but email body) publishing ADAM Web Design Internet Industry 1 08-23-2007 11:05 PM
Forged Email Headers and Email Load on Server zephyrireland Hosting Issues 13 10-05-2006 07:28 PM
email marketing - email lists gr Marketing Strategies Discussion Forum 4 03-15-2006 09:42 AM
Email interviewer required Endomorph Services for Sale/Hire 0 02-22-2006 05:32 AM


All times are GMT -4. The time now is 03:10 PM.



Search Engine Optimization by vBSEO 3.3.0