Welcome Guest, Not a member yet? Register   Sign In
Javascript links using anchor();
#1

[eluser]Iván Argulo[/eluser]
If you want to use the anchor() function for javascript links, you just have to change a little bit the url_helper, line 149, as follows:
Code:
$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;

Replace with:
Code:
if (substr($uri, 0, 10) == 'javascript')
$site_url = $uri;
else
$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;

Or you can download the modified file attached to this post.

With this change, you can do this (note: the "javascript" word is removed for security).
Code:
anchor('[removed] doSomething()', 'Do something', 'title="Do something"');




Theme © iAndrew 2016 - Forum software by © MyBB