AleMonteiro 238 Can I pick my title?

You're welcome, and right.Even if doens't affect nothing at the current implementation, it will still be processed without changes to the UI.

If solved, please mark as such.

Seeya.

AleMonteiro 238 Can I pick my title?
AleMonteiro 238 Can I pick my title?

You are going to load a url into an iframe, and if it doesn't load for some reason(broken) you want to try and load another url? Is that it?

AleMonteiro 238 Can I pick my title?

Try this instead:

$("#button").popover({content:'<span id="test">Test</span>', html:true, placement:"bottom"});
AleMonteiro 238 Can I pick my title?

JorgeM is right, you have to install both SQL Server Express and SQL Server Express Managment Studio.

AleMonteiro 238 Can I pick my title?

Due to browser security AJAX request can only be made to the same domain. That this if you domain is mydomain.com you won't be able to make an AJAX request to google.com.

To do this kind of verification, you need to have a server-side script that will make the validation, and your interface will make an AJAX request to that script.

AleMonteiro 238 Can I pick my title?

Do you have HTML 5 doctype at the top of your page?

AleMonteiro 238 Can I pick my title?

Something like this:

var numRows = 10,
    numCols = 10,
    strHtml = '';

for(var i=0; i < numRows; i++) {
    strHtml += '<tr>';
    for(var j=0; j < numRows; j++) {
        strHtml += '<td>1</td>';
    }
    strHtml += '</tr>';
}

document.getElementById('MyTable').innerHTML = strHtml;
AleMonteiro 238 Can I pick my title?

You are welcome. But two concerns about your code:

1."#navBox ul li.mainList" will accept click in any content of 'mainList'. This means that when you click a item in the 'subList' the listener will be triggered too.
2."#navBox ul li.mainList" it's not a recommended selector. It works, but is not fast. Because jQuery will search all levels of itens to find it. In your case it's a lot better to use just 'li.mainList' or at least '#navBox > ul > li.mainList'.

Another thing, $(function(){}); it's an abreviation of $(document).ready(function(){});

With that in mind, I'd suggest:

$(function(){
    $("li.mainList > a").click(function(){           

        $("ul.subList").removeClass("visible");
        $(this).parent().find("ul").addClass("visible");

    });
});
AleMonteiro 238 Can I pick my title?

What do you mean by 'go out' of the ifram tag? Is it not restricted to the iframe size, is that it?

AleMonteiro 238 Can I pick my title?

Hi, first thing, your script is loaded and executed at load time. This mean that when the script is run the DOM is not ready, so none of the objects that you are trying to add an handler to will exist. This means that the listeners are not attached.
To solve this, call your scripts at the load of the page. One way of doing it is:

//jQuery on DOM loaded event
$(function() {
    $(".mainList a").click(function(){
        $(this).find("ul").toggle();
    });
});

Another thing, the selector '.mainList a' will select all 'a' inside '.mainList'. This mean that all 'a', even in the sub-menus will be selected.

To select only the 'a' in the main list do as '.mainList > a' (will select only the 'a' that is directly bellow '.mainList').

Another thing, "$(this).find('ul')" will find nothing. Because $(this) is an '<a>' and there's nothing inside it to be found. An solution it's to use 'next' instead of 'find' (find only search inside the selected element, while 'next' search in the same level as the element)

Here's one example that should work fine:

//jQuery on DOM loaded event
$(function() {
    $(".mainList > a").click(function(){ // Attach click to <a> directly bellow .mainList
        $(this).next("ul").toggle();
    });
});
AleMonteiro 238 Can I pick my title?

Sorry, I miss-read your HTML structure at first.

Change those two lines, to get the inputs.

$inputA = $tr.find("input.woordveld"), // Gets the first input which has the 'woordveld' class
$inputB = $tr.find("input.amount"); // Gets the second input which has the 'amount' class

Another thing, I never seen a name like this 'numberarray[]'. I really don't know if it may cause problems, but I don't recommend it.

AleMonteiro 238 Can I pick my title?

ita, I'm really not sure.

When I see a ugly code with bugs, I think it's easiest to remake the code. Cause normally it's solves the problem, and even if it doesn't, it'll be much simplier to debug it.

But I really don't know the bug in your code, I didn't find any by looking at it.

AleMonteiro 238 Can I pick my title?

I don't understand, if the EmpStatus is on the Job table, what do you mean by job details not updated?

AleMonteiro 238 Can I pick my title?

Try this out:

SELECT
    e.EID
FROM
    Employee AS e
WHERE
    e.EmpStatus = 'Active' AND
    e.EID NOT IN (SELECT DISTINCT j.EID FROM Job AS j )
AleMonteiro 238 Can I pick my title?

Try this out:

$('#B3').click(function(){

    var hasError = false,
        jsonData = {},
        $startex = $("#startex"),
        $error = $("#error");

    // Verify value for all fields and create the json data
    for( var i=1; i < 14; i++) {
        var val = $('#t' + i).val();
        if ( val == '' ) {
            hasError = true;
            break;
        }
        jsonData['t' + i] = val;
    }

    // If has errors show the message and stop the process
    if ( hasError ) {
        $startex.hide();
        $error.show();
        return;
    }

    $error.hide();
    $startex.show();

    $.getJSON("insertmaster.php?ran="+Math.random(), jsonData, function(data){

        $startex.hide();

        if (data=="done"){
            $('#doneex').show();
        } 
        else {
            $('#alreadyexsits').show();
        }
    });

});
AleMonteiro 238 Can I pick my title?

To use like this, you must do the following:

<form action="gegevens.php" method="POST" onsubmit="return validateTable(tabelinhoud);" name="woorden">

And the function must return true or false:

function validateTable(tableId) {
    var hasErrors = false;

    $("#" + tableId).find("tr").each(function() {
        var $tr = $(this),
            $inputA = $tr.children("td").eq(0).children("input"), // Gets the first input
            $inputB = $tr.children("td").eq(2).children("input"); // Gets the second input

        if ( $.trim( $inputA.val() ) != '' && $.trim( $inputB.val() == '' ) ) {
            hasErrors = true;
        }
    });

    if ( hasErrors ) {
        alert("Has Errors");
    }

    return ! hasErrors;
}
AleMonteiro 238 Can I pick my title?

This should work, if each row in the table has the two inputs:

function validateTable(tableId) {
    $("#" + tableId).find("tr").each(function() {
        var $tr = $(this),
            $inputA = $tr.children("td").eq(0).children("input"), // Gets the first input
            $inputB = $tr.children("td").eq(2).children("input"); // Gets the second input

        if ( $.trim( $inputA.val() ) != '' && $.trim( $inputB.val() == '' ) {
            alert("Error encontered!");
        }
    });
}
AleMonteiro 238 Can I pick my title?

I prefer plugins or components over scripts, because when I modify a plugin I do it in a way that the funcionality is only incresead. I make sure that nothing that was working stoped, even if not used in the case.

But when I get a script or a code sinept I just change what I need for that one time use.

Another thing is that scripts usually doensn't have a object model. Because if it has, it would be more like a component.

In my opnion, that's the reason plugins are more popular than scripts.

AleMonteiro 238 Can I pick my title?

Post the html structure for 'myvideo'

AleMonteiro 238 Can I pick my title?

You could do something like this:

<script type="text/javascript">

var PhoneMake = 'PhoneMake'; // First select, when this changes the select two will be reloaded
var PhoneModel = 'PhoneModel'; // Second select, reloaded when the first changes

var selectedPhone = '<?php print $_SESSION['PhoneMake']?>'; // Gets the value stored in the session
var selectedPhoneModel = '<?php print $_SESSION['PhoneModel']?>';

$(function() { // On DOM Loaded
    $.get("getModels.php", { // Request the options for the first select
        func: "getMake",
        drop_var: ""
    }, function(options) { 
        $("#" + PhoneMake) // Get the object for the first select
            .html(options) // Set the options returned
            .unbind('change') // Clean any change listener
            .change(function() { // Add a change event listener
                // When the change occurs the second select will be loaded
                var selectedValue = $(this).val(); // Gets the selected value from the first select
                $.get("getModels.php", { // Request the options for the second select
                    func: "getModel",
                    drop_var : selectedValue
                }, function(options2) {

                    $("#" + PhoneModel).html(options2); // Sets the options returned

                    // After loading the options, verify if there is one already selected
                    if ( selectedPhoneModel != '' ) {
                        $("#" + PhoneModel') // Gets the object for the phone model select
                            .val(selectedPhoneModel) // Sets it's value as the selected phone model in the session      
                    }
                });
            });

        // After loading the options, verify if there is one already selected
        if ( selectedPhone != '' ) {
            $("#" + PhoneMake) // Gets the object for the phone select
                .val(selectedPhone) // Sets it's value as the selected phone in the session …
AleMonteiro 238 Can I pick my title?

I'd suggest to keep the ajax in background searching for new messages, when a new message is found it'll be shown to the user and then marked as 'readed' in the database.

This way the user will only be notified until the message is readed.

And to make sure that the user readed the message, you could do like facebook, when the new message arrives just add an small notification on the screen, but the message will be marked as readed only when the user clicks it and see the details.

AleMonteiro 238 Can I pick my title?

fabzter, the variable passed to the php is 'drop_var', which has the value of the selectedValue.

$.get("getModels.php", { // Request the options for the second select
                    func: "getModel",
                    drop_var : selectedValue // the param name is 'drop_var'
                }

You can either change the php to get 'drop_var' or edit the javascript and change 'drop_var' to 'selectedValue'

AleMonteiro 238 Can I pick my title?

I really didn't understand your doubt, please try to explain in another way.

AleMonteiro 238 Can I pick my title?

TIM,

this error means that you are trying to use an object that has not been setted, or has been setted as null.

You should see in which line the error occurs and then analyse it to see what may be happening to let that object as null.

AleMonteiro 238 Can I pick my title?

I think this should do the trick:

var selectOneID = 'mySelectOne'; // First select, when this changes the select two will be reloaded
var selectTwoID = 'mySelectTwo'; // Second select, reloaded when the first changes

$(function() { // On DOM Loaded

    $.get("func.php", { // Request the options for the first select
        func: "getTierOne",
        drop_var: ""
    }, function(options) { 
        $("#" + selectOneID) // Get the object for the first select
            .html(options) // Set the options returned
            .unbind('change') // Clean any change listener
            .change(function() { // Add a change event listener
                // When the change occurs the second select will be loaded

                var selectedValue = $(this).val(); // Gets the selected value from the first select

                $.get("func.php", { // Request the options for the second select
                    func: "drop_1",
                    drop_var : selectedValue
                }, function(options2) {

                    $("#" + selectTwoID).html(options2); // Sets the options returned

                });

            });
    });

});

Just set the selectOneID and the selectTwoID for the ID's of the selects. In the exemple it would be:

<select id="mySelectOne" size="1"></select>
<select id="mySelectTwo" size="1"></select>
AleMonteiro 238 Can I pick my title?

I just commented the code so you know what each line does:

$(document).ready(function() { // On DOM Loaded
    $('#wait_1').hide(); // Hides Wait_1
    $('#drop_1').change(function(){ // Listener for changes on Drop_1
      $('#wait_1').show(); // Shows Wait_1
      $('#result_1').hide(); // Hides Result_1
      $.get("func.php", { // Call func.php page in background
        func: "drop_1",
        drop_var: $('#drop_1').val()
      }, function(response){ // func.php response handler
        $('#result_1').fadeOut(); // Hides Result_1
        setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); // Calls finishAjax after 400ms
      });
        return false;
    });
});

function finishAjax(id, response) {
  $('#wait_1').hide(); // Hides Wait_1
  $('#'+id).html(unescape(response)); // Set the html of the result
  $('#'+id).fadeIn(); // Shows the result
}
AleMonteiro 238 Can I pick my title?

Your are welcome, just mark the thread as solved please.

And if you can, I'd like to take a look at the editor.

AleMonteiro 238 Can I pick my title?

You could use something like this:

var frame = document.getElementById("myIFrame"); // iFrame with the HTML
var div = document.getElementById("myDiv"); // div to show the HTML

div.innerText = frame.document.body.innerHTML; // Sets the Text of the div as the HTML of the frame.

Using innerText will not parse the HTML.

AleMonteiro 238 Can I pick my title?

This will sum all values from all selects in the document that begins with 'category':

window.onload = function() {
            var sum = sumSelects('category');
            alert('Sum of Category: ' + sum);
        }

        function sumSelects(name) {
            var selects = document.getElementsByTagName('select'),
                sum = 0;
            for(var i=0, il=selects.length; i<il; i++) {
                var
                    slc = selects[i],
                    slcName = slc.name;

                if ( slcName.indexOf(name) > -1 ) {
                    sum += getValue(slc);
                }
            }   
            return sum;
        };

        function getValue(slc) {
            return parseInt(slc.options[slc.selectedIndex].text);
        };
AleMonteiro 238 Can I pick my title?

I would use JQuery:

    <script>
        $(function() // on DOM loaded
            $("#btnSubmit").click(function(){ // Click handler 
                var yMax = $("#txtYmax").val(); // Get YMax value
                $.ajax(
                    'MyPhpPage.php', // Page to handle the request
                    { yMax : yMax }, // Parameters to send
                    function(result) { // Function executed when the request is completed
                        $("#forResult").html(result);
                    },
                    function(erro) { // Function executed when the request throws an error
                        //do something
                    }
                );
            });
        });
    </script>
    <body>
        Ymax: <input type="text" id="txtYmax" size="15">
              <input type="button" value="Submit" id="btnSubmit">
        <div id="forResult"></div>
</body>
AleMonteiro 238 Can I pick my title?

Just by curiosity, I made a version extending the Table Cell prototype:

HTMLTableCellElement.prototype.getText = function() {
    return typeof this.textContent === 'string' ? this.textContent : this.innerText;
};

var cell = document.getElementById('home');

alert(cell.getText());
AleMonteiro 238 Can I pick my title?

Using JQuery:

var text = $("#home").text();

Using pure JavaScript:

var cell = document.getElementById('home');
var text = typeof cell.textContent === 'string' ? cell.textContent : cell.innerText;
AleMonteiro 238 Can I pick my title?

For what I see, you set an live click listener to the class 'modalDlg2' for loading the dialogs, but in nowhere you create a <a> with the class 'modalDlg2'.

Besides that, I can't help you much because your code isn't testable.

If you want help with your JS, I suggest that you post a code with only HTML, CSS and JS, so it can be tested.

Cheers.

AleMonteiro 238 Can I pick my title?

Just use the 'view source' button at this page: http://jqueryui.com/tabs/#vertical

AleMonteiro 238 Can I pick my title?

None of the links works.

AleMonteiro 238 Can I pick my title?

Assuming that the $(this).index() is the ListView index, you could do something like:

$(this).find("li.selected-class")

Probably the ListView uses some css class to indicate which item is selected or not. I don't know which class it is, but it shouldn't be hard to figure it out.

AleMonteiro 238 Can I pick my title?

This should help you:

<!DOCTYPE html>
<html>

<body>
    <script>
    var ProgressBar = function(max, objButton, objText) {
        this.max = max;
        this.text = objText;
        this.current = 0;
        this.button = objButton;

        this.text.value = this.current;

        this.started = false;

        var _self = this;

        this.button.onclick = function() {
            if ( _self.started === true ) {
                _self.stop();
            }
            else {
                _self.start();
            }
        }
    }

    ProgressBar.prototype.start = function() {
        this.started = true;
        var _self = this;
        this.button.innerText = "Stop";
        this.interval = setInterval(function() {
            _self._tick();
        }, 70);
    };

    ProgressBar.prototype.stop = function() {
        this.started = false;
        clearInterval(this.interval);
        this.button.innerText = "Start";
    };

    ProgressBar.prototype._tick = function() {
        this.current++;
        if ( this.current == this.max ) {
            this.stop();
        }
        this.text.value = this.current;
    };

    window.onload = function() {
        new ProgressBar(100, get("btnStart1"), get("txtProgress1"));
        new ProgressBar(100, get("btnStart2"), get("txtProgress2"));
        new ProgressBar(100, get("btnStart3"), get("txtProgress3"));
    };

    function get(id) {
        return document.getElementById(id);
    }

    </script>

    <button id="btnStart1" type="button">Start</button>
    <input id="txtProgress1" type="text" value="0"/>

    <br/>

    <button id="btnStart2" type="button">Start</button>
    <input id="txtProgress2" type="text" value="0"/>

    <br/>

    <button id="btnStart3" type="button">Start</button>
    <input id="txtProgress3" type="text" value="0"/>

    <br/>
</body>
AleMonteiro 238 Can I pick my title?

Take a look at jQuery UI, they have drag and drop helpers.

AleMonteiro 238 Can I pick my title?

ctrenks,

I may be wrong, but as far as I understand, the Canvas object of HTML 5 is for 2d and 3d draw. You can't have an <div > inside a <canvas>.

And I don't think that have doubts abouth the plataform, it's decided, it'll be Web with HTML/CSS/JS. The question that I see is about the UI architeture.

And to be clear, I think you missunderstand the AJAX concept. AJAX has nothing to do with your interface, it is only an assync request to the server using XMLHttpRequest.

Your entire interface will be manipuled by JavaScript, and using AJAX(that is only a concept, not an programming language or a framework) you'll make the request to the server.

About the UI, you could simply create the HTML structure and a few JS functions to handle the flow. Or you could do something a litle more sofisticated, and build an object oriented model for your card game.

In example, the prototype could look something like this:

// Namespace
    var CardGame = {}; 

    // Card Deck
    CardGame.Deck = function() {
        var 
            cardValues = ['A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K'],
            cardClubs = ['Clubs', 'Diamonds', 'Hearts', 'Spades'],
            i=0,
            j=0;

        this.cards = new Array();

        for(var i=0, il=cardValues.length; i < il; i++) {
            for(var j=0, jl=cardClubs.length; j<jl; j++) {
                this.cards.push(new CardGame.Card(cardValues[i], cardClubs[j]));
            }
        }
    }

    CardGame.Deck.prototype.alertCards = function() {
        alert(this.cards.length);
    };

    CardGame.Card = function (value, club) {
        this.value = value;
        this.club = club;

        return this;
    };

    window.onload = …
AleMonteiro 238 Can I pick my title?

JorgeM,

corner-radius is a CSS 3 feature. It'll not work on earlier versions of any browser.

From W3Scholls:

The border-radius property is supported in IE9+, Firefox 4+, Chrome, Safari 5+, and Opera.

AleMonteiro 238 Can I pick my title?

I just tested and it seems to work fine in IE 9.

With one detail: you must set the doctype to HTML 5

<!DOCTYPE html>
AleMonteiro 238 Can I pick my title?

Taywin,

I wasn't sure either, but I did a quick test and it really does.

But you said something interesting, how could I handle the backbutton myself? Do you know which methods I would have to overwrite?

AleMonteiro 238 Can I pick my title?

Where do you store the answers to each question?

In the example shown the citiesDB has only the questions and not the answers.

You could use something like:

var citiesDB = [
{ id: "1", question: "Capital city of America?", answer: "Einstein", options: [ 'Einstein', 'Option 2', 'Option 3...] },
{ id: "1", question: "Planck?", answer: "Planck", options: [ 'Option 1', 'Planck', 'Option 3...] },
AleMonteiro 238 Can I pick my title?

I did not understand your problem. Can you explain your self better?

AleMonteiro 238 Can I pick my title?

hlamster,

when the back button is pressed, the previous page will be reloaded, so the onload event will be dispatched.

You need something like this:

<script language='javascript' type='text/javascript'>
    window.onload = function() {
        initShowHideRows('pc_parade_float', 'vehreg');
    };
</script>
AleMonteiro 238 Can I pick my title?

Try:

SELECT 
    SUM(bet1) as bet1, 
    SUM(bet2) as bet2, 
    SUM(bet3) as bet3
FROM 
    MyTabtle
AleMonteiro 238 Can I pick my title?

It throws any errors?

Try running on IIS: set the properties and create the virtual directory

AleMonteiro 238 Can I pick my title?

Hi, answer some questions please:

  1. Which visual studio are you using?
  2. Wich type of project are you working on? (ASP.NET WebSite, ASP.NET Web Application, etc)
  3. How are you running the website? VS development server, IIS or other web server?
AleMonteiro 238 Can I pick my title?