Results 1 to 3 of 3
  1. #1
    Experienced User
    Overall activity: 8.0%

    Join Date
    Apr 2008
    Posts
    194
    Liked
    7 times
    Points
    6,363

    Ask about javascript

    is theres a code in javascript that if an alertbox is shown, there will be a timer to close it

    For example

    I have terms and agreement in the alertbox
    he has to read it for about 15 sec
    if the time is > 0 then the ok button is disabled
    once the time is = 0 then you can click ok


    thanks guys

  2. #2
    Administrator
    Overall activity: 46.0%

    Join Date
    Nov 2006
    Location
    Malaysia
    Posts
    9,802
    Liked
    1656 times
    Points
    48,740
    Here are some examples.
    https://www.maybank2u.com.my/mbb/m2u/common/M2ULogin.do?action=Login
    http://tyler.tc/facebook-traffic-pop/

    In order to use the Maybank2u's version, you need to rip the code from a few different places.
    Some example of the code being used.

    Code:
    <script type="text/javascript">  $(document).ready(function() {	 	 	var d = new Date(); 	 	if (d.getMonth() == 0) 	{ 		$('div.outer').css('background' , '#C00000'); 	} 	else if (d.getMonth() == 1) 	{ 		$('div.outer').css('background' , '#000000'); 	} 	else if (d.getMonth() == 2) 	{ 		$('div.outer').css('background' , '#7F7F7F'); 	} 	else if (d.getMonth() == 3) 	{ 		$('div.outer').css('background' , '#EAB200'); 	} 	else if (d.getMonth() == 4) 	{ 		$('div.outer').css('background' , '#E2D700'); 	} 	else if (d.getMonth() == 5) 	{ 		$('div.outer').css('background' , '#C00000'); 	} 	else if (d.getMonth() == 6) 	{ 		$('div.outer').css('background' , '#000000'); 	} 	else if (d.getMonth() == 7) 	{ 		$('div.outer').css('background' , '#7F7F7F'); 	} 	else if (d.getMonth() == 8) 	{ 		$('div.outer').css('background' , '#EAB200'); 	} 	else if (d.getMonth() == 9) 	{ 		$('div.outer').css('background' , '#E2D700'); 	} 	else if (d.getMonth() == 10) 	{ 		$('div.outer').css('background' , '#C00000'); 	} 	else if (d.getMonth() == 11) 	{ 		$('div.outer').css('background' , '#000000'); 	} 	else  	{ 		$('div.outer').css('background' , '#7F7F7F'); 	} 	  	//Get the screen height and width 	var maskHeight = $(window).height(); 	var maskWidth = $(window).width();  	//Set heigth and width to mask to fill up the whole screen 	$('#mask').css({'width':maskWidth,'height':maskHeight}); 	 	//transition effect		  	$('#mask').fadeIn(600);	 	$('#mask').fadeTo("slow",0.75);	  	//Get the window height and width 	var winH = $(window).height(); 	var winW = $(window).width();         	//Set corner popup window to center 	$('div.outer').css('top',  (winH/2-$('div.outer').height()/2)-150); 	$('div.outer').css('left', (winW/2-$('div.outer').width()/2)-30); 		  	//corner 	$('div.outer, div.round').fadeIn(600);  	 	//if close button is clicked 	$('.close').click(function (e) { 	 		$('div.outer').fadeOut(50); 		$('#mask').fadeOut(500); 		 	});		 	 	//if mask is clicked 	$('#mask').click(function () { 		// Do nothing - remark to enable 		$('div.outer').fadeOut(50); 		$('#mask').fadeOut(500); 	});	 	 	$('div.round').each(function() { 	      var q = $(this).corner("round 8px").parent().css('padding', '15px').corner("round 10px"); 	      eval(q); 	}); 	 	 	$.fn.timedDisable = function(time) {     if (time == null) {         time = 3000;     } 	    var seconds = Math.ceil(time / 1000); 	    return $(this).each(function() { 	        $(this).attr('disabled', 'disabled'); 	        var disabledElem = $(this); 	        disabledElem.width(120); 	        var originalText = this.innerHTML; 	        disabledElem.text( originalText + ' (' + seconds + ')'); 	        var interval = setInterval(function() { 	            disabledElem.text( originalText + ' (' + --seconds + ')'); 	            if (seconds === 0) { 	                disabledElem.removeAttr('disabled').text("OK"); 	                clearInterval(interval); 	            } 	        }, 1000); 	    }); 	}; 	 	$(function() { 	    $('#btnOK').timedDisable(); 	}); 		 });  </script>
    Code:
    <div id="cornercolor"> 	<div class="outer"> 		<div class="round"> 			<div style="text-align:absolute;width:650px;"> 			<p style="font-size:17px;margin: 0 auto;text-align:left;"><b>m2u Security Tips:</b></p> 			<p>&nbsp;</p> 			<p>&nbsp;</p> 			<p> 				<table> 					<tr> 						<td align="left" style="font-size:12px;margin: 0 auto;text-align:left;padding-left: 15px;"> 				  			<li>&nbsp;</li> 						</td> 						<td style="font-size:12px;margin: 0 auto;text-align:left;"> 							Did you know that public WiFi networks and shared PCs are unsecured? This could pose a threat to your internet security whether you are carrying out online banking transactions or any other transmission of personal information. 						</td> 					</tr> 					<tr> 						<td colspan="2">&nbsp;</td> 					</tr> 					<tr> 						<td align="left" style="font-size:12px;margin: 0 auto;text-align:left;padding-left: 15px;"> 				  			<li>&nbsp;</li> 						</td> 						<td style="font-size:12px;margin: 0 auto;text-align:left;"> 							We strongly encourage you to only access online banking via your personal computer and always remember to clear your browser's cache after each online banking session. 						</td> 					</tr> 				</table> 			</p> 			<p>&nbsp;</p> 			<p>&nbsp;</p> 			<p style="font-size:13px;margin: 0 auto;text-align:left;"><b>Important:</b></p> 			<p style="font-size:13px;margin: 0 auto;text-align:left;">1. ALWAYS manually type www.maybank2u.com.my to access Maybank2u.com</p> 			<p style="font-size:13px;margin: 0 auto;text-align:left;">2. NEVER click on any email links claiming to direct you to Maybank2u.com</p> 			<p>&nbsp;</p> 			<p>&nbsp;</p> 			<p style="font-size:13px;margin: 0 auto;text-align:right;"><b>More tips coming your way! </b></p> 			<p>&nbsp;</p> 			 			<p><button id='btnOK' class="close">Please wait..</button></p> 			<p>&nbsp;</p> 			</div> 		</div> 	</div> </div>
    Code:
    body class="mNav1" onload="hideOverlay();" onpageshow="hideOverlay();">

  3. #3
    Experienced User
    Overall activity: 8.0%

    Join Date
    Apr 2008
    Posts
    194
    Liked
    7 times
    Points
    6,363
    this is hard, ill try to do this

 

 
All times are GMT +8. The time now is 01:12 AM.