karimali831 Posted May 8, 2011 Share Posted May 8, 2011 For example with this: onclick="getNextParticipants(this);this.blur();" Can I use if statement to check if user has clicked on the event? Quote Link to comment https://forums.phpfreaks.com/topic/235851-check-if-onclick-has-been-clicked/ Share on other sites More sharing options...
sunfighter Posted May 8, 2011 Share Posted May 8, 2011 Yes, it can be done. You do have to save this in a file or database, but here is a method of using global variables to spy on the users: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Save File</title> <script type="text/javascript"> var store = 'User click on '; function tattle(stuff){ store += '-'+stuff; } function kick(){ document.getElementById('here').innerHTML = store; } </script> </head> <body> <input value="First" type="button" onclick="tattle('getNextParticipants')" /> <input value="Second" type="button" onclick="tattle('second')" /> <input value="Last" type="button" onclick="tattle('getNextUglyFaces')" /> <br /><br /><br /> <input value="Reveal the sneaky stuff" type="button" onclick="kick()" /> <div id="here">sneeky stuff here</div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/235851-check-if-onclick-has-been-clicked/#findComment-1212492 Share on other sites More sharing options...
Adam Posted May 9, 2011 Share Posted May 9, 2011 What do you mean 'to check if they clicked'? The event is only triggered when the user clicks the target..? Quote Link to comment https://forums.phpfreaks.com/topic/235851-check-if-onclick-has-been-clicked/#findComment-1212879 Share on other sites More sharing options...
karimali831 Posted May 9, 2011 Author Share Posted May 9, 2011 I'm really sorry if this is off the question but have noticed this is what I no longer require.. ok, this <div> tag: <div id="from_0" class="rPosButton '.$active_1_20.'" style="height: 184px;" onclick="getNextParticipants(this);this.blur();" onmouseover="Tip( get_value(\'1 - 20\'), TEXTALIGN, \'justify\', ABOVE,\'true\', TEXTALIGN, \'justify\', PADDING,10, TEXTALIGN, \'justify\', OPACITY,90, TEXTALIGN, \'justify\', FIX,[300,450], TEXTALIGN, \'justify\', DELAY,1, TEXTALIGN, \'justify\' );" onmouseout="UnTip();"> will trigger the onclick event: function getNextParticipants(button){ from = $(button).id.split('_')[1]; $('ULLIST_0').innerHTML = $('Loader').innerHTML; $$('.PosButtons').each(function(f){ $(f).select('.active').each(function(e){ e.removeClassName('active'); }); }); $(button).addClassName('active'); var listname = 'ranking'; if(friends){ var listname = 'friends'; } new Ajax.Updater('ULLIST_0', webRoot + '?site=standings&ladderID=<?php echo $_GET[ladderID]; ?>', { method: 'post', parameters: { listname: listname }, onComplete: function(transport){ //var bnts = $('RSCROLLBAR').childElements(); bnts = get_visible_elements($('RSCROLLBAR').childElements()); for(i=0; i < bnts.length; i++){ if(bnts[i].id==button.id){ if(i==0){ $('ladders_button_up').addClassName('previous_button_disabled'); if(bnts.length > 1){ $('ladders_button_down').removeClassName('next_button_disabled'); }else{ $('ladders_button_down').addClassName('next_button_disabled'); } }else if(i==(bnts.length-1)){ $('ladders_button_up').removeClassName('previous_button_disabled'); $('ladders_button_down').addClassName('next_button_disabled'); }else{ $('ladders_button_up').removeClassName('previous_button_disabled'); $('ladders_button_down').removeClassName('next_button_disabled'); } } } markMyPosition(); prepareTooltips(); ptt_init(); } }); } in PARENT target, I want it to open in top target. So I tried... new Ajax.Updater('ULLIST_0', top.location = '?site=standings&ladderID=<?php echo $_GET[ladderID]; ?>', { but this will open the page on pageload, without "top.location =" it opens page without pageload but opens in parent instead of top target. I would really appreciate if someone can help me with this... thank you! Quote Link to comment https://forums.phpfreaks.com/topic/235851-check-if-onclick-has-been-clicked/#findComment-1213094 Share on other sites More sharing options...
karimali831 Posted May 11, 2011 Author Share Posted May 11, 2011 Please help someone, have I missed something? Quote Link to comment https://forums.phpfreaks.com/topic/235851-check-if-onclick-has-been-clicked/#findComment-1214183 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.