InnerHTML updated link fails

Page: 1

Author Post
dmmunro
Guest
Hi folks.. I have a padlock on the front end of my app that allows users to see "members only content"..
The link looks like this:

<a href="template/iframeContent.php?h=350&w=260&file=member.php?mode=0" rel="floatboxMember" rev="type:ajax showItemNumber:false navType:none width:280 height:140 scrolling:no"><img src="images/icons/addressbar_low_security.png" border="0" alt="Members Area" title="Members Area"></a>


when the user logs in the padlock icon is changed using this code and the link is updated with innerhtml


try{ top.document.getElementById('padlock').innerHTML = '<div id=\"padlock\" style=\"margin:0px; position:absolute; left:0px; top:0px; z-index:999;\"><a href=\"template/process_member.php?unset=Y\" target =\"ExecuteFrame\"><img src=\"images/icons/addressbar_no_security.png\" border=\"0\" alt=\"Members Area\" title=\"Members Area\"></a></div>';}catch(exception){

now I have php code that logs the user out of the session for the content that is protected using this code block.


if($_REQUEST['unset'] == 'Y'){
echo "<script lanugage='javascript1.2'>
try{ top.document.getElementById('padlock').innerHTML = '<div id=\"padlock\" style=\"margin:0px; position:absolute; left:0px; top:0px; z-index:999;\"><a href=\"template/iframeContent.php?h=350&w=260&file=member.php?mode=0\" rel=\"floatboxMember\" rev=\"type:ajax showItemNumber:false navType:none width:280 height:140 scrolling:no\"><img src=\"images/icons/addressbar_low_security.png\" border=\"0\" alt=\"Members Area\" title=\"Members Area\"></a></div>';}catch(exception){}

var rev = 'type:ajax width:200px height:75px';
parent.fb.loadAnchor('showlogout.html', rev);
</script>";
unset($_SESSION['member']);
unset($_SESSION['loggedin']);
exit;
}


All this works except the that the replaced link will not re-launch a new floatbox windwo for a new login despite the links being exactly the same as the first link.

Any ideas?
cheers
Administrator
Registered: Aug 2008
Posts: 3382
You have to run tagAnchors() against the updated content. That function ran at floatbox load time and added the required onclick actions to the anchors. The refreshed anchor doesn't have that onclick action.
top.fb.tagAnchors(top.document.getElementById('padlock'));
Search for tagAnchors in the floatbox docs or in this forum for more info.
dmmunro
Guest
Thanks... knew it had to be something simple like that.
NOW I know why my photo gallery wouldn't load correctly when called by ajax.
Cheers
M

Page: 1