SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict AdRock952's Avatar
    Join Date
    Aug 2006
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Email harvesting prevention

    I have some javascript to display an email address but i want to keep it in an external file and just call the function to display it when needed.

    Apart from including the .js file, how to i call the function from the html page where it's needed?

    Code JavaScript:
    function displayMail {
     
    	var name='you';
    	var domain='your-domain.org.uk';
     
    	document.write("<p><a href='mailto:" + name + "@" + domiain + "'>");
    	document.write(name + "@" + domain);
    	document.write("</a></p>"); 
    }

    I just want to call the function in a page

  2. #2
    SitePoint Addict AdRock952's Avatar
    Join Date
    Aug 2006
    Posts
    243
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2008
    Location
    Dublin, Ireland
    Posts
    461
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure how you fixed it but the addLoadEvent is a good unobtrusive way to have functions run when the page has loaded. Especially if other scripts might want to run onload as well as this one.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •