AleMonteiro 238 Can I pick my title?

Try alerting the value you are submiting to see if it's ok.

I also suggest that you use your browser Network Profiler (in development tools) to analyse if the request is being made, and if so what's is being sent and what's being recieved.

var valToEdit = edit_form.user_edit.value;
alert("Editing: " + valToEdit);
$.post(
    'edit_script.php',  
    {user_edit: valToEdit},
    function (dresult, textStatus) { 
        alert("Result: " + textStatus);
        $("#d_result").html(dresult).show();
    }
);

If this doesn't help, try swting to .ajax() and use an error callback function.

AleMonteiro 238 Can I pick my title?

In my opnion, if you want to learn you shouldn't use any frameworks. To learn you have to code it all. The more you code the more you'll learn.
Choose and language and go hardcore with it.

I'd suggest PHP or C#, the top two languages in web development today (in my opnion).

For PHP I use Notepad++. I tried NetBeans for a short while too but didn't like it very much.
For C# I use Visual Studio 2010.

And keep in mind that for Web Development you'll also need to take care of your user interface, using (x)HTML, CSS and JavaScript (or VBScript if you prefer, and if you do, I'm so sorry =P )

AleMonteiro 238 Can I pick my title?

Not Tested:

var timer = {

    // ID of div to display the time
    divId: "myDivId",

    // Used to store the div object
    div: undefined,

    // Used to store the interval object
    interval: undefined,

    // Used to store the current time
    currentTime: 0,

    // Initialize timer
    init : function() {

        timer.div = document.getElementById(timer.divId);

        timer.interval = setInterval(function() {

            timer.currentTime = currentTime + 1;

            timer.updateTimeDisplay();

        }, 1000); // 1000 milliseconds = 1 second
    },

    updateTimeDisplay: function() {
        timer.div.innerHTML = timer.currentTime + " seconds";
    },

    stop: function() {
        clearInterval(timer.interval);
    }

};

// Initialize timer
timer.init();


// Stop timer after 100000 milliseconds
setTimeout(function() {

    timer.stop();

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

You need to post your form and then get the value, something like this:

Form:

<form action="MyPage.php" method="post">

    <select name="mySelect">
        <option value="1">My First Option</option>
    </select>

    <button type="submit">Submit</button>
</form>

MyPage.php:

$selectedOption = $_POST["mySelect"];
// Do something
AleMonteiro 238 Can I pick my title?

This should work for removing one item at a time: myListBox.Itens.RemoveAt(myListBox.SelectedIndex).

If you want to enable mutiple selection/deletion you'll need to loop the SelectedIndices property.

AleMonteiro 238 Can I pick my title?

Which line throws the error?

AleMonteiro 238 Can I pick my title?

I didn't understand what's your problem/doubt.

AleMonteiro 238 Can I pick my title?

Hi Violet. I'd use more like this:

<html>
    <head>
        <title>test</title>
        <style>
        .theForm{
            background-color:#f4f4f4;
            margin-top:14px;
            padding:25px 0 40px 25px;
            font-size: 0.875em;/* 14/16*/
            color: #333333;
        }
        .theForm #email, .theForm #residence {
            width:52.33333333333333%; /* 314/600*/
        }
        .theForm #theMonth {
            width:14.5%; /* 87/600*/
        }
        .theForm #theYear{
            width:14.5%; /* 87/600*/    
        }

        .theForm a#mandatory{
            font-size:0.75em;/*12/16*/
        }
        .theForm select option{
            color: #333333;
        }
        .theForm #theDay{
            width:14.5%; /* 87/600*/
        }
        .theForm #specificDay{
            width:14.5%; /* 87/600*/    
        }
        .clear{clear:both;}
        #main{
            width:600px;
            margin:0 auto;
        }

        .inline
        {
            position: relative;
            display: -moz-inline-stack;
            display: inline-block;
            zoom: 1;
            vertical-align: top;

            *display: inline;
        }
        .label {
            width: 200px;
        }
        .form-row {
            margin-bottom: 10px;
        }
        /*REGISTER FORM*/
        </style>
    </head>
    <body>
        <div id="main">
            <div class="theForm">
                <form>

                    <div class="form-row">
                        <span class="inline label">Email address:</span><input type="text" name="email" id="email">
                    </div>

                    <div class="form-row">
                        <span class="inline label">theMonth / theYear of birth:</span>
                        <select name="theMonth" id="theMonth">
                            <option value="theMonth"></option>
                            <option value="January"></option>
                            <option value="February"></option>
                            <option value="March"></option>
                            <option value="April"></option>
                            <option value="May"></option>
                            <option value="June"></option>
                            <option value="July"></option>
                            <option value="August"></option>
                            <option value="September"></option>
                            <option value="October"></option>
                            <option value="November"></option>
                            <option value="December"></option>
                        </select>
                        <select name="theYear" id="theYear">
                            <option value="theYear"></option>
                            <option value="1940"></option>
                            <option value="1941"></option>
                            <option value="1942"></option>
                            <option value="1943"></option>
                            <option value="1944"></option>
                            <option value="1945"></option>
                            <option value="1946"></option>
                            <option value="1947"></option>
                            <option value="1948"></option>
                            <option value="1949"></option>
                            <option value="1950"></option>
                            <option value="1951"></option>
                        </select>
                        <a href="#" id="mandatory">Why this?</a>
                    </div>

                    <div class="form-row">
                        <span class="inline label">theDay of resignation:</span>
                        <select name="theDay" id="theDay">
                            <option value="theMonth"></option>
                            <option value="January"></option>
                            <option value="February"></option>
                            <option value="March"></option>
                            <option value="April"></option>
                            <option value="May"></option>
                            <option value="June"></option>
                            <option value="July"></option>
                            <option value="August"></option>
                            <option value="September"></option>
                            <option value="October"></option>
                            <option value="November"></option>
                            <option value="December"></option>
                        </select>
                        <select name="theMonth" id="specificDay">
                            <option value="theYear"></option>
                            <option value="1940"></option>
                            <option value="1941"></option>
                            <option value="1942"></option>
                            <option value="1943"></option>
                            <option value="1944"></option>
                            <option value="1945"></option>
                            <option value="1946"></option> …
AleMonteiro 238 Can I pick my title?

Yes, that'd better. The CSS gradient will ajust the effect when the div resizes.

AleMonteiro 238 Can I pick my title?

Violet, if it's an small image you can use repeat-y, but the result will depend much on kind of image, it could be ridiculous for some images with effects.

The other option is to make a bigger image so it will only show more or less of it. How much bigger depends on how much the banner area can increase.
The problem with this option is that with you use an vertical gradient, when the banner height is low the gradient won't show properly.

In my opnion, handling multiple size images background is not that simple. If it will be an fixed image you can try and sort things out. But if the idea is to make a dynamic image spot (change image every day i.e.) this will be really painful, I'd suggest to set an fixed size, or have multiple sizes of the image and change with JS according to the new size of the space.

AleMonteiro 238 Can I pick my title?

I find this most usefull: http://colorschemedesigner.com/

AleMonteiro 238 Can I pick my title?

Div's width by default is 100% of it's parent.
In your case I think it would be easier to use an <span>, wich the width just wrap it's content.

Or you can set display: inline to the div, wich will make it just wrap it's content.

AleMonteiro 238 Can I pick my title?

Sorry, I don't have any tutorials or code to land you in this case. I don't code much in PHP.

AleMonteiro 238 Can I pick my title?

Sorry, never heard about it and I didn't find anything on google.

AleMonteiro 238 Can I pick my title?

The loop seems fine. Try trimming the word, maybe it's getting an white space from the text file.
And just to be sure reset the value of the text box before inserting the dashes.

AleMonteiro 238 Can I pick my title?

Just a guess, but I think you have to use "" instead of '' to assing the variables into the text.

Try like this: "<th>{$header}</th>\n" and "<th>{$value}</th>\n"

AleMonteiro 238 Can I pick my title?

I'm not sure, but maybe this will help you:

<!DOCTYPE html>
<html>
    <head>
        <title>TEST</title>

        <style type="text/css">
            /* Generated by F12 developer tools. This might not be an accurate representation of the original source file */
        #wrapper {
            border: 1px solid red; width: 100%; height: 43em;
        }
        #page {
            margin: 0px auto; border: 1px solid magenta; width: 75%; height: 40em;
        }
        #banner {
            background: #000; /* using image as background here must take care of repeat-y so when the browser resize and this banner height increase the background will also increase*/
            border: 1px solid blue; 
            min-height: 65px; /* use min-height instead of height so when the browser resize the banner can increase it's height to wrap the elements that break line */
            position: relative;
            min-width: 260px; /* min width so the cnes logo doesn't go on top of the other one */
        }
        #logo1 {
            border: 1px solid red; 
        }
        #logoText {
            width: 350px;
        }
        #logoText p {
            border: 1px solid blue; color: white;
        }
        #cnes {
            border: 1px solid yellow; top: 0px; height: 60px; right: 0px; position: absolute;
        }

        /*css style to make divs stay inline without the use of float*/
        .inline
        {
            position: relative;
            display: -moz-inline-stack;
            display: inline-block;
            zoom: 1;
            vertical-align: top;

            *display: inline;
        }

        </style>

    </head>

    <body>
        <div id="wrapper">       
            <div id="page">      
                <div id="banner">

                    <div id="logo1" class="inline">
                        <img src="http://antobbo.webspace.virginmedia.com/test/responsive/small_LOGO.gif">                           
                    </div>
                    <div id="logoText" class="inline">                   
                            <p>This is an extra bit</p>
                    </div>
                    <div id="cnes">  
                        <img src="http://antobbo.webspace.virginmedia.com/test/responsive/cnes.jpg" >                                        
                    </div>
                </div>
            </div>
        </div>
    </body>

</html>
AleMonteiro 238 Can I pick my title?

Do you mean a database engine called Profile or a database profiler(tool for testing performance)?

AleMonteiro 238 Can I pick my title?

Using AJAX you can show the content to the user in the browser, but not download it.

For downloading a file see this link: http://php.net/manual/en/function.readfile.php

or this one: http://www.terminally-incoherent.com/blog/2008/10/13/php-file-download-script-straming-binary-data-to-the-browser/

AleMonteiro 238 Can I pick my title?

You didn't say what is the problem or what you don't know how to do it.

So, let me suggest you something, test your getdat.php in the browser and see what is the result.

AleMonteiro 238 Can I pick my title?

You need to show the div when msg === true:

$('#result').html(quantity+' items');   
$('#result').show();   

// OR, using chaning

$('#result')
    .html(quantity+' items')
    .show();

Also, this is very ugly and with poor performance: $('input:text#quantity').val();
Use just #quantity or as you are already inside the event scope, you could use just $(this).

So, I think this code would be better wrote as:

$('#quantity').keyup(function(){
        var
            quantity = $(this).val()
            , $result = $('#result');

        if(isInteger(quantity))
        {
            var msg = false;
            if(quantity > 1)
            {
                msg = true;
            }

            // more code . . .

            if(msg === true)
            {
                 $result
                    .html(quantity+' items')
                    .show();   
            }
            else
            {
                $result.hide();
            }
        }
    });
cereal commented: perfect! many thanks! +10
AleMonteiro 238 Can I pick my title?

I think it's ok, but I'd use more like this:

function isDuplicate(names,phone,email,adresa){ 
        var isduplicate=false; 

        for(var i=0,il=addresslist.length, addr; i<il, addr=addresslist[i]; i=i+1){ 
            if(    addr.names.toLowerCase()==names.toLowerCase() 
                && addr.phone.toLowerCase()==phone.toLowerCase()
                && addr.email.toLowerCase()==email.toLowerCase()
                && addr.adresa.toLowerCase()==adresa.toLowerCase()
            )
            { 
                isduplicate=true; 
                break; // Stop loop if it's duplicated
            } 
        } 
        return isduplicate; 
    } 

    // Verify if value is only number
function isNumber(val) {
    return !isNaN(parseInt(val));
}
AleMonteiro 238 Can I pick my title?

Like this:

$(document).ready(function () {
   $('input').change(function () {
      window.onbeforeunload = function () { return "You still have unsaved changes!" };
  });
  $("#mySubmitButton").click(function() {
    window.onbeforeunload = undefined;
    // OR
    window.onbeforeunload = function() {};
  });
});
AleMonteiro 238 Can I pick my title?

Like this:

///For 2nd Schedule Interview
$('#cbmSSId').bind('change', function(e) { 
    e.preventDefault();        

    var value = $(this).val();

    if ( value == 'Interviews' ) {
        $('#Interviews').bPopup();    
    }                      
    else if ( value == 'Something Else') {

    }
    else {

    }

});
AleMonteiro 238 Can I pick my title?

There's probally a simpler way, but this should work:

var myString = "Hello Word";
var counters = {};

// Count letters
for(var i=0, l=myString.length,c; i<l, c=myString[i]; i=i+1) {
    if ( typeof counters[c] != 'undefined' ) {
        counters[c] = 1;
    }
    else {
        counters[c] = counters[c] + 1;
    }
}

// Show letters
for(var c in counters) {
    document.write(c + ' ocurred ' + counters[c] + ' times');
}
AleMonteiro 238 Can I pick my title?

You are welcome.
Good luck with your learning.
Seeya

AleMonteiro 238 Can I pick my title?

If I understood correctly this should be a good implementation for you:
http://valums.com/files/2009/menu/final.htm

And this is how it's done:
http://valums.com/scroll-menu-jquery/

AleMonteiro 238 Can I pick my title?

What didn't you understand?

AleMonteiro 238 Can I pick my title?

I'd use something like this:

var lis = [];

for(var i=0, il=items.length,item; i<il, item=items[i]; i=i+1){ 
    lis.push(String.format(
        '<li> ' +
            '{0} [ {1} ] [ {2} ] [ {3} ] ' +
            '<a href="void(0);" class="deletebtn" contactid="{4}"> delete contact </a>' +
        '</li>'
        , item.names, item.phone, item.email, item.adresa, item.id
    ));
} 

list.html(lis.join(""));

The String.format method is this one:

// --------------------------------------
// String.format
// --------------------------------------

String.prototype.format = function () {
    return String.format(this, arguments.length == 1 ? arguments[0] : arguments);
};

String.format = function (source, params) {
    var _toString = function (obj, format) {
        var ctor = function (o) {
            if (typeof o == 'number')
                return Number;
            else if (typeof o == 'boolean')
                return Boolean;
            else if (typeof o == 'string')
                return String;
            else
                return o.constructor;
        } (obj);
        var proto = ctor.prototype;
        var formatter = typeof obj != 'string' ? proto ? proto.format || proto.toString : obj.format || obj.toString : obj.toString;
        if (formatter)
            if (typeof format == 'undefined' || format == "")
                return formatter.call(obj);
            else
                return formatter.call(obj, format);
        else
            return "";
    };
    if (arguments.length == 1)
        return function () {
            return String.format.apply(null, [source].concat(Array.prototype.slice.call(arguments, 0)));
        };
    if (arguments.length == 2 && typeof params != 'object' && typeof params != 'array')
        params = [params];
    if (arguments.length > 2)
        params = Array.prototype.slice.call(arguments, 1);
    source = source.replace(/\{\{|\}\}|\{([^}: ]+?)(?::([^}]*?))?\}/g, function (match, num, format) {
        if (match == "{{") return "{";
        if (match == "}}") return "}";
        if (typeof params[num] != 'undefined' && params[num] !== null) {
            return _toString(params[num], format);
        } else {
            return "";
        }
    });
    return …
AleMonteiro 238 Can I pick my title?

See if this works:

$(function(){

    $('ul#groupCat li').click(function(){

        var 
            catChoice= $(this).attr('cat'),
            $subMain = $("#subMain");

        if(catChoice == "00"){
            $subMain.find("div.box").slideDown();
            $subMain.find("div.categorie").slideDown().removeAttr('catsort');
            return;
        }

        $subMain
            .find('div.categorie[cat!="' + catChoice + '"]') // div categorie who is not the catChoice
                .slideUp();

        $subMain
            .find("div.categorie[cat=" + catChoice + "]") // div categorie who is the catChoice
                .attr('catsort', 'Yes') 
                .slideDown() 
            .parent() // box who has the catChoice categorie
                .slideDown();

        $subMain
            .find('div.box:not(:has(div.categorie[cat="' + catChoice + '"]))') // Only boxes that does not have the categorie
                .slideUp();
    }); 

});
AleMonteiro 238 Can I pick my title?

Try like this:

$.ajax({ 
     url: 'addressbook.php', 
     data: {
        action: 'add',
        name: name,
        phone: phone,
        email: email,
        adresa: adresa
    },
    dataType: 'json', 
    type: 'post'
});
AleMonteiro 238 Can I pick my title?

Try something like this(not tested):

$(function(){

    $('ul#groupCat li').click(function(){

        var 
            catChoice= $(this).attr('cat'),
            $subMain = $("#subMain");

        if(catChoice == "00"){
            $subMain.find("div.box").slideDown();
            $subMain.find("div.categorie").slideDown().removeAttr('catsort');
            return;
        }

        $subMain
            .find('div.categorie[cat!="' + catChoice + '"]') // div categorie who is not the catChoice
                .slideUp();

        $subMain
            .find("div.categorie[cat=" + catChoice + "]") // div categorie who is the catChoice
                .attr('catsort', 'Yes') 
                .slideDown() 
            .parent() // box who has the catChoice categorie
                .slideDown()
            .siblings("div.box") // other boxes
                .slideUp();
    }); 

});
AleMonteiro 238 Can I pick my title?

You didn't correct the issues that I told you.

AleMonteiro 238 Can I pick my title?

Check the response using the success event. Like this:

sucess: function(data, textStatus) {

}

You should use your browser JS debugger and Networking monitoring to identify the errors.

You should also certify that your PHP configuration is set to show all the errors.

AleMonteiro 238 Can I pick my title?

I don't think so. It should be like this:

$.ajax({ 
     url: 'addressbook.php?action=saveContact', 
     data: {
        name: name,
        phone: phone,
        email: email,
        adresa: adresa
    },
    dataType: 'json', 
    type: 'post'
});
AleMonteiro 238 Can I pick my title?

So just don't use the onMouseOut event.
You just have to handle onMouseOver to change the images/content.

AleMonteiro 238 Can I pick my title?

There's a couple of syntax errors in your code, try like this:

$(function(){
    var $a = $("#content");
    $a.append('<div class="scrollbar"><%--some content here-----%></div>')
});

And I'm assuming that yout scrollbar function uses the class scrollbar to add the functionality. But keep in mind that the function must be called after this append.

AleMonteiro 238 Can I pick my title?

First of all, you shoudln't have multiple elements with the same ID. ID selectors only return the first element. So, use class instead of id in this case: <div class="categorie">

Then you should use the attribute selector of jQuery for selectiong an element with an specific cat attribute. Like this: $("#subMain).find("div.categorie[cat=2]")

AleMonteiro 238 Can I pick my title?

But the example posted does reload the whole page. It's a simple redirect to the same page with different parameters.

AleMonteiro 238 Can I pick my title?

You can check if the screen width/height is the same of the window width/height.

Actually you have to use screen.availHeight to get the screen height without the taskbar.

Something like this(not tested):

if ( screen.height == window.height ) { // FullScreen Mode

}
else if ( screen.availHeight == window.height ) { // Maximized

}
else { // Other size

}
AleMonteiro 238 Can I pick my title?

You can either create the checkboxes in the form design view and use an ID for each one. Or you can create then dynamicaly at run time using some loop.

AleMonteiro 238 Can I pick my title?

Here is how you do it:

function putTime(x,y) {

    var theDate = new Date(x*1000); // convert time value to milliseconds
    var now = new Date(); // Now

    var dif = theDate.getTime() - now.getTime(); // Difference between dates in millisseconds

    // Date is in the past
    if ( dif < 0 )  {
        // Do Something     
    }
    // Date is in the future
    else {
        setTimeout(function() {
            // Code to be executed when the 'now' becames 'theDate'
        }, dif);
    }
}
LastMitch commented: Nice! +9
AleMonteiro 238 Can I pick my title?

If it does what it should do, then it's OK. Complexity doesn't mean quality.

Complex codes could be a result of one(or a combination) of various cases:

  • Too much and too complex functionalities
  • Security reasons (complex code are more dificult to analyse, copy and break)
  • Performance reasons (to get the best performance sometimes complexity is needed)
  • Bad programmer that doesn't know what he/she is doing
  • Good programmer that just wanted to make anyone who uses 'view source' confuse
AleMonteiro 238 Can I pick my title?

Hi,

if you check the default example in http://jqueryui.com/autocomplete/ you'll see that the default functionality is exactly what you want.
You don't need any extra event handling to make this happen.

Try updating to the last version of jQuery UI.

AleMonteiro 238 Can I pick my title?

I still don't get what you want, please post examples step by step, like this:

['a', 'b', 'c', 'd']
['a', null, 'c', 'd']
['a', null, null, 'd']
AleMonteiro 238 Can I pick my title?

Hello and welcome to DaniWeb.

I don't wish to be rude, but please search a little bit in this forum and you'll you find a lot of great answers to your questions.

There's a similar post about learning and starting with Web Developemnt every week.

We're here to help and instruct, but, and I think I can say it for the most of us, aswering the same question over and over again suck the life out of us.

Here are some topics that may help you:
http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/403930/where-to-learn-javascript

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/443678/need-new-resource-to-learn-javascript

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/323948/want-to-learn-javascript

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/356136/where-to-learn-javascript

http://www.daniweb.com/web-development/web-design-html-and-css/threads/129216/is-css-hard-to-learn-how-to-do

http://www.daniweb.com/web-development/web-design-html-and-css/threads/118720/learning-css

http://www.daniweb.com/web-development/web-design-html-and-css/threads/323425/training-to-learn-html-css

http://www.daniweb.com/web-development/web-design-html-and-css/threads/63801/learning-web-design-html-css-etc

Ps.: I don't think that daniweb seach is good enough, so I use google to find what I want, like this:
learn javascript site:DaniWeb.com
learn css site:DaniWeb.com
learn PHP site:DaniWeb.com

Hope it helps and you learn a lot =)

AleMonteiro 238 Can I pick my title?

Let's see if I understood:

// You have an array (I'll use letters to make it more clear)
var myArray = ['a', 'b', 'c', 'd', 'e'];

// Then you want to remove an random index and change the index of all others elements as well
// So the result should be like this
var myResultArray = ['e', 'b', 'd', 'a'];

So, if what you want is on those lines, check this sample out:

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var arr = ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"];

// Remove item from array by index
function removeIndex(arr, index) {
    var len = arr.length;

    // First item
    if ( index == 0 ) {
        return arr.slice(1);
    }
    // Last item
    else if ( len-1 >= index ) {
        return arr.slice(0, len-1);
    }
    // Middle item
    else {
        var arr1 = arr.slice(0, index-1);
        var arr2 = arr.slice(index);

        return arr1.concat(arr2);
    }
}

// Generates random number
function getRandom(min, max) {
    return Math.floor((Math.random()*max)+min);
}

function slice() {  
    // remove random index
    arr = removeIndex(arr, getRandom(0, arr.length));

    // shuffle the rest of the array
    arr.sort(function(){
        return Math.round(Math.random()) - 0.5;
    });

    // log result in div
    var div = document.getElementById("divResult");
    div.innerHTML = div.innerHTML + '<br/>' + arr.toString();
}

</script>

</head>

<body>
    <button onclick="slice();" type="button">Slice and Suffle</button>
    <div id="divResult"></div>
</body>
</html>
AleMonteiro 238 Can I pick my title?

Try Integer.toString(a) or String.valueOf(a)

AleMonteiro 238 Can I pick my title?

If the page will never have scroll, set overflow: hidden.

If you describe how the interface should look like, or, even better, post a example of the layout we can suggest better ideas.

AleMonteiro 238 Can I pick my title?

I really didn't understand what you are trying to do.
You have an array and you want to delete an random item of that array? Is that it?