Click here to Skip to main content
15,894,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<table id =table1>
<tr>
<td>
Hide after 10 seconds
</td>
</tr>
</table>
<table id =table2>
<tr>
<td>
show after 10 seconds
</td>
</tr>
</table>


javascript

<script type="text/javascript">

   setTimeout({ jQuery("#table1").show(); }, 10000);

   setTimeout({ jQuery("#table1").show(); }, 20000);

</script>

my code does not work help please ?
Posted

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
     setInterval(function(){$("#table1").toggle()}, 10000);
});
</script>
</head>
<body>
<table id="table1" border="1">
<tr>
<td>
    Toogle every 10 seconds
</td>
</tr>
</table>
</body>
</html>
 
Share this answer
 
Comments
[no name] 30-Jul-14 1:30am    
It worked :)
Use this :
C#
<script type="text/javascript">
       $(document).ready(function () {
           setInterval(function () {
               $("#table2").is(":visible") ? $("#table2").hide() : $("#table2").show();
               $("#table1").is(":visible") ? $("#table1").hide() : $("#table1").show();
           }, 10000);


       });
   </script>

Source : http://jsfiddle.net/jRmrp/15/[^]

Note : Apply style="display:none;" to table2.
 
Share this answer
 
v2
Try this in your script block.

XML
<script>
    jQuery(document).ready(function()
    {
        jQuery("#table2").hide();
        window.setTimeout("jQuery('#table1').hide()",10000);
        window.setTimeout("jQuery('#table2').show()",10000);
    });
</script>


Also, put your vallue for the s' id in quotes, that is

use

HTML
<table id ="table1"> and <table id ="table2">


instead of
HTML
<table id =table1> and <table id =table2>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900