You are my hero!
Now I have this little email encrypter:

        // This is to prevent two searches
        var email = $('span.email');
        email.html( email.html().replace(' [monkeytail] ', '@').replace('
[dot] ', '.') ).wrapInner('<a href="mailto:' + email.text() +
'"></a>');

What I had was this:
        createEmailAddress();
        
        function createEmailAddress() {
                var a = ' [apenstaartje] ';     // put the @-replacement here
                var monkeytail = $('.email');
                for (var i = 0; i < monkeytail.length; i++) {
                        var b = monkeytail[i];
                        function parseText(b) {
                                var theText = '';
                                if (b.normalize) b.normalize();
                                for (var c, j = 0; c = b.childNodes[j]; j++)
                                if (c.nodeType == 3) theText += c.nodeValue;
                                return theText;
                        };
                        var c = parseText(b);
                        var d = new Array();
                        d = c.split(a);
                        var e = (d[0] + '@' + d[1]);
                        var f = b.parentNode;
                        var g = document.createElement('a');
                        if (d.length > 1) {
                                f.appendChild(g);
                                g.setAttribute('href','mailto:' + e);
                                g.appendChild(document.createTextNode(e));
                                f.replaceChild(g,b);
                        }
                }
        };

That's why you got to love jQuery!


On Thu, Jun 19, 2008 at 9:18 PM, Isaak Malik <[EMAIL PROTECTED]> wrote:
> Oh sorry, the code I gave you just modifies the loaded HTML and doesn't
> write it back so this should work for you:
>
> // This is to prevent two searches
> var email = $('span.email');
>
> email.html( email.html().replace('[monkeytail]', '@') );
>
> Enjoy
>
>
> On Thu, Jun 19, 2008 at 8:33 PM, IschaGast <[EMAIL PROTECTED]> wrote:
>>
>> > $('span.email').html().replace('[monkeytail]', '@');
>>
>> I was also thinking it should be something like this, but this doesn't
>> work...
>> This should be possible some way I hope.
>>
>> > And you probably also need:
>> >
>> > $('span.email').html().replace('[dot]', '.');
>> >
>> > On Thu, Jun 19, 2008 at 12:26 AM, IschaGast <[EMAIL PROTECTED]>
>> > wrote:
>> >
>> > > I have this: <span class="email">contact [monkeytail] yabadabadoo
>> > > [dot] .com</span>
>> > > Now I want to replace the text [monkeytail] with some other text.
>> >
>> > > Is there a simple solution that I can get the monkeytail text and
>> > > replace it with something else?
>> >
>> > --
>> > Isaak Malik
>> > Web Developer
>
>
>
> --
> Isaak Malik
> Web Developer
> >
>

Reply via email to