Modal Window load dynamic content and change it in times

Hy guys.

I have a modal window that loads a page and I need to, after 90 seconds load another page.

I have...

    <table id="table4">

According to the ID, i will load a page that the id represents.. like and after 90 seconds I have to load the other id...

Now I have this script...

$(document).ready(function() {

//seleciona os elementos a com atributo name="modal"
var aux = 2;
while (($("#table4 tr:nth-child(" + aux + ") td:nth-child(1)") != "")) {

    var idSOS = $("#table4 tr:nth-child(" + aux + ") td:nth-child(1)").text();
    if ((idSOS != "") && (idSOS != undefined) && (idSOS != null) && (idSOS != "Id:")) {

        $("#dialog, #mask,#closediv").css({ 'display': 'block' });
        var maskHeight = "99%";
        var maskWidth = "99%";
        $('#mask').css({ 'width': maskWidth, 'height': maskHeight });

        $('#mask').fadeTo("slow", 1);
        $('#dialog').fadeTo("slow", 1);

        var winH = $(window).height();
        var winW = $(window).width();
        //centraliza na tela a janela popup
        $("#dialog, #mask").css('top', '2px');
        $("#dialog, #mask").css('left', '2px');


        setTimeout(function() {
            var i = idSOS;
        }, 10000);

        //            continue;
    } //end IF
    else {
        $("#dialog, #mask").hide();


$("#dialog, #mask").hide();

//se o botão fechar/tela for clicado
$('#closediv').click(function GetOut(e) {
    $('#mask,#closediv, .window').hide();

function loadContent(idSOS) {
    $("#dialog").load('/teste' + idSOS + '.aspx');

It only shows the second id loaded in the div. What I have to do to load the first ID loaded in the DIV "dialog" and then, after 90 seconds, show the second ID?

Where did I go wrong?

Thks folks.


I believe this happens because setTimeout expects first parameter to be a string, and you gave it a function, which is probably being executed right away

so the code should be more like:

setTimeout("function() { ... }", 90000);

however, your logic still appears to have flaws, as the "each" statement will create 2 setTimeout() functions that will both be executed at the same time after 90 seconds.

This is because it will iterate over both columns (TD) present and execute everything that is in the "each" part every time.

The code most probably needs a more detailed revision.

This line is clearing the dialog right after loading it:


Then, in the 90 second timeout, it loads the second item successfully.

Need Your Help

HTML / CSS - Center align a UL navigation menu

html css

Im trying to centre align a image based navigation menu, i have read a few different posts, but none of them seem to be working.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.