Jag gillar jquery


<a id="mail"></a>

(function($) {
    $.fn.extend({
        mailLink: function(options) {
        
    		var defaults = {
                userName: "nobody",
                domainName: "localhost",
                topLevelDomain: ""    		                
            };

            var options = $.extend(defaults, options);
					    		
    		return this.each(function() {
    	    	var obj = $(this);
    	    	var emailAdress = options.userName + "@" + options.domainName + ( (options.topLevelDomain == "") ? "" : "." ) + options.topLevelDomain;  
    	    	obj.attr("href","mailto:" +emailAdress).text(emailAdress);
    		});
        }
    });
})(jQuery);

$(document).ready(function(){
$("#mail").mailLink({userName:'info', domainName:'reurl', topLevelDomain:'se'});
});

Publicerat av

Peter Lindblom

Mer info om mig finns på sidan https://plweb.se/om-peter-lindblom/