473,799 Members | 3,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide email address with image as link

I'm hiding the email address on a website with this javascript which
works fine:
---------------------------------
<p>Send your comments and questions to our

<script language=javasc ript>

<!--

var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.co m"

document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->

</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?

Thanks in advance

Mar 9 '06 #1
17 2169
HornyLaBelle said the following on 3/9/2006 6:42 AM:
I'm hiding the email address on a website with this javascript which
works fine:
No, you just think it works fine.
---------------------------------
<p>Send your comments and questions to our

<script language=javasc ript>
<script type="text/javascript">
<!--
Drop the ill conceived notion of hiding scripts.
var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.co m"

document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->
Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.
</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?


Instead of the variable contact, you would write out an img tag.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 9 '06 #2
HornyLaBelle wrote:
I'm hiding the email address on a website with this javascript
Utter nonsense.
which works fine:


No, it does not.
PointedEars
Mar 9 '06 #3
<p>Send your comments and questions to our
<script language=javasc ript>
<!--
var contact = '<img src="gfx/some_image.png" alt="email me">'
var email = "news"
var emailHost = "netmechanic.co m"
document.write( "<a href=" + "mail" + "to:" + email + "@" +
emailHost+
">" + contact + "</a>" + ".")
//-->
</script>
</p>



Mar 9 '06 #4
//-->


Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.


Why? What's the problem?
Mar 9 '06 #5
> > How can I make an image instead of the text as a link to start this
script?


Instead of the variable contact, you would write out an img tag.


I tried this but it doesn't work. Can you please give an example? I
don't know a lot about javascript...

Mar 9 '06 #6
Gernot Frisch wrote:
//-->


Drop the hiding scripts, it isn't needed anymore and can actually do
harm in some circumstances.

Why? What's the problem?


The main problem is that some script authors think they can use HTML style
comments anywhere in the script, then can't work out why it won't run.

The tags also get carried over to .js files where their potential effects
can be masked further. The content of script elements should be passed
as-is to the script engine. It seems that modern browsers either remove
the tags before passing the content to the script engine, or the engine
itself deals with them. Provided the opening tag comes before any real
script they don't cause a problem, but that can't be relied upon /ad
infinitum/.

Note that comments should never have been required for script elements
inside the head, which is where most of them are.

Another potential hazard is if the tags are used with XHTML - but again
some browsers seem to 'fix' that.

--
Rob
Mar 9 '06 #7

"HornyLaBel le" <sa****@gmx.d e> schrieb im Newsbeitrag
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
> How can I make an image instead of the text as a link to start
> this
> script?


Instead of the variable contact, you would write out an img tag.


I tried this but it doesn't work. Can you please give an example? I
don't know a lot about javascript...


See my other reply - it's all there
Mar 9 '06 #8
Greetings,

First I must apologize for users like PointedEars who somehow think
they are making a contribution by bad mouthing people who need help. It
seems every post they make does nothing to further anyone's
knowledge.

Here is how you would fix your code to use an image:

<script language=javasc ript>
var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.co m";
document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
height='58' border='0'>"+co ntact+"</a>");
</script>

Also, if interested I have written a free JavaScript utility I use for
all my clients that encrypts email links for you. You can even pass it
a CSS class to use While the method you are using works for basic
protection, malicious harvesting robots can still read your source code
and piece things together. Especially when you use keywords like
"email".

http://www.manifestinteractive.com/tools/hiddenemail/

Hope this helps,
Peter Schmalfeldt

HornyLaBelle wrote:
I'm hiding the email address on a website with this javascript which
works fine:
---------------------------------
<p>Send your comments and questions to our

<script language=javasc ript>

<!--

var contact = "Newsletter Editor"

var email = "news"

var emailHost = "netmechanic.co m"

document.write( "<a href=" + "mail" + "to:" + email + "@" + emailHost+
">" + contact + "</a>" + ".")

//-->

</script>

</p>
---------------------------------
How can I make an image instead of the text as a link to start this
script?

Thanks in advance


Mar 9 '06 #9
Manifest Interactive wrote:
First I must apologize for users like PointedEars who somehow think
they are making a contribution by bad mouthing people who need help.
It seems every post they make does nothing to further anyone's
knowledge.
At least I /know/ what I am talking about.

You are not helping the OP by posting this "solution", you are hurting
him/her in the mid-term. Because e-mail communication will be impossible
for many, if not most, of his/her users while you give the false impression
that this would be a viable approach that serves at least many users.
There is a word for that: incompetence.
Here is how you would fix your code to use an image:

<script language=javasc ript> ^^^^^^^^^^^^^^^ ^^^^^ var contact = "Newsletter Editor";
var email = "news";
var emailHost = "netmechanic.co m";
document.write( "<a href='mailto:"+ email+"@"+email Host+"'><img
src='http://groups.google.c om/groups/img/groups_medium.g if' width='150'
height='58' border='0'>"+co ntact+"</a>"); ^^^^
The markup is not Valid, and therefore not supposed to be interoperable.

1. The `language' attribute is deprecated long since (December 1999),
the `type' attribute is required. The language attribute is not
Valid in HTML 4.01 Strict, XHTML 1.0 Strict, and XHTML 1.1.

2. mailto: is known to be highly unreliable (IOW: known not to work).

3. Writing the link with client-side scripting and so introducing a
dependency on that technique makes it even worse.

4. The `img' element requires the `alt' attribute, as text alternative
if the image cannot be displayed.

5. ETAGO delimiters </ must be escaped within CDATA element content, or
the element is considered to end prematurely by the markup parser,
causing a syntax error for the script engine here.

So there are the following possibilities:

1. There is no client-side script support, the script is filtered by a
proxy, or the client works strictly standard compliant:

The user sees exactly nothing, and depending on the strictness of
the parser, if there is client-side script support, and the script
is not filtered, the user gets a nice error message, too.

2. There is client-side script support, the script is not filtered,
and despite the markup being not Valid the script is executed, but

a) the user is blind or visually impaired, and therefore can not find
the link (there is no text that can be interpreted by a Braille line
or read to him aloud by a screenreader);
b) there is no e-mail client installed;
c) the HTML user agent (UA) does not support mailto: URIs;
d) the e-mail client is not configured with the UA to handle mailto: URIs

Where each of b) to d) is highly likely with users having a Web mail
account.

For the infinitesimal tiny rest of users, this nonsense actually works.
Big time.
[unsolicited advertising]
[top post]


FOAD!
PointedEars
Mar 9 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2768
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your response. Sergio ------------------------------------------------ <script language="JavaScript" type="text/javascript">
117
11897
by: Steevo | last post by:
Any suggestions as to the best programs for cloaking email addresses? Many thanks -- Steevo
4
5192
by: web_design | last post by:
I put this together from some other scripts I am using on a site. I'm trying to make a better email hiding script. It isn't working. Also, it causes Internet Explorer 6 SP2 to block the script as "active content". :( The idea is that if the user doesn't have JavaScript enabled, they will see an image of the email address (that can't be read by email harvesting programs). If JavaScript is enabled, the image will be hidden and the...
1
1703
by: frekster | last post by:
Hi. Looking for some feedback on how to prevent a specific spam attack. I have a form for a person to subscribe to a mailing list and they can type in their email and click submit to subscribe. They then are sent an email asking them to click a link to confirm. how can I prevent a spammer from simply looping through thousands of emails and populating my email list table with thousands of records and crashing the system?
4
4232
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however I would really like to use linked images instead to do the following: - When open.gif is clicked, the contents of the div show and open.gif is swapped with close.gif - subsequently, when close.gif is clicked, the div contents get hidden
1
2475
by: Mahernoz | last post by:
Hi Friends, I have a Registration page which uses Asp.net CreateUserWizard Control. Now I want to send a unique value(a guid) by which i can be sure that the email address is of that user only. I will provide a Textbox in the next step which the user has to input so that his email address is confirmed. Do you know how this is done with the CreateUserWizard Control?
12
2969
by: laredotornado | last post by:
Hi, I'm using PHP 5. I was wondering given an image, a.jpg, how can I make an image that would look like you slid a white index card (which I have a file, white.jpg with the same dimensions as a.jpg) over a.jpg? Note that you'd be sliding the image from top to bottom or from left to right, but not both. Thanks, let me know if this makes sense ... it's a litlte hard to describe.
0
10785
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.