Tagged: Button Link, javascript
-
AuthorPosts
-
November 12, 2015 at 1:12 pm #534708
Hello guys,
I have a problem with javascript in a button link I use to encrypt my email address.
When I use this script in a button link:
javascript:linkTo_UnCryptMailto(‘nbjmup;ifmmpAyejwfssft/di’);
nothing append when i heat the button.
you can try here : https://uiuxdesigner.ch/en/#socket
But when I use the link in a widget text in another page it works fine
https://uiuxdesigner.ch/en/portfolio-item/qui-livre-chez-moi-web-service/#socketThe script associated in the <head> is like this:
<script type="text/javascript"> <!-- function UnCryptMailto( s ) { var n = 0; var r = ""; for( var i = 0; i < s.length; i++) { n = s.charCodeAt( i ); if( n >= 8364 ) { n = 128; } r += String.fromCharCode( n - 1 ); } return r; } function linkTo_UnCryptMailto( s ) { location.href=UnCryptMailto( s ); } // --> </script>
Do you have an idea of what the problem is ?
Thanks,
XavierNovember 12, 2015 at 4:59 pm #534893Hey Xavier!
So your adding this part..
javascript:linkTo_UnCryptMailto(‘nbjmup;ifmmpAyejwfssft/di’);
To the URL of the button? That’s not going to work. It needs to be added to the onclick attribute. You can right click your page and view it’s source and copy the HTML for the button and then add it into a codeblock element in your page and add the onclick attribute there.
Regards,
ElliottNovember 13, 2015 at 10:24 am #535304Hey Elliott,
Thanks for the feedback !
I copy the code of the button as you said:
<a href="javascript:linkTo_UnCryptMailto(‘nbjmup;cpokpvsAyejwfssft/di’);" target="_blank" class="avia-button avia-icon_select-no avia-color-theme-color avia-size-large avia-position-left ">Envoyez moi un email</a>
And paste it in a code block of my page but it is not working.
You can try it here : https://uiuxdesigner.ch/#socket -(button link on the right)the script to unencrypt the email link is in the <head>
Did I miss something ?
Xavier
November 19, 2015 at 4:34 am #538699Hey!
Please remove the modifications then use this in the functions.php file:
// decrypt add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script type="text/javascript"> (function($) { function UnCryptMailto( s ) { var n = 0; var r = ""; for( var i = 0; i < s.length; i++) { n = s.charCodeAt( i ); if( n >= 8364 ) { n = 128; } r += String.fromCharCode( n - 1 ); } return r; } $('.decrypt_email').on('mouseover', function() { $(this).attr('href', UnCryptMailto('nbjmup;cpokpvsAyejwfssft/di')); }); })(jQuery); </script> <?php }
.. Replace the button code with this:
<a class="avia-button decrypt_email avia-icon_select-no avia-color-theme-color avia-size-large avia-position-left" href="#">Envoyez moi un email</a>
Best regards,
IsmaelNovember 19, 2015 at 9:51 am #538813Thanks for the help, it works perfectly fine !
November 20, 2015 at 10:13 am #539396February 20, 2016 at 8:12 am #586419hm Ismael – does not work here on my site
February 22, 2016 at 8:36 am #586945 -
AuthorPosts
- You must be logged in to reply to this topic.