Javascript to click a link

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
feign3
Forum Newbie
Posts: 1
Joined: Thu Nov 18, 2010 3:00 pm

Javascript to click a link

Post by feign3 »

My subject is much simpler than my problem and I wasn't sure if I should post this in the PHP board or here. Here are the basics:

I have a site built within Joomla. The standard login is able to be triggered by a link and displayed in a lightbox but as far as I can tell, the lightbox trigger only works when clicking the link. I'm trying to find a way to simulate the clicking of this link but I need to do it only after determining if the user is logged in which is done by calling a Joomla user function. So in a nutshell, here is an example of the code:

Code: Select all

if ($user->guest) {
   EXECUTE SOMETHING HERE TO "CLICK" A LINK TO ACTIVATE THE LIGHTBOX LOGIN
}
This is the code that activates the login lightbox from a link:

Code: Select all

<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>
Does anyone have any suggestions on how this could be done?
Post Reply