
Ottima raccolta di tutorials su good-tutorials.com divisi per categorie.
Sito web: http://www.good-tutorials.com/…



Sito web: http://www.noupe.com/..-tutorials.html…

Ottimo sito dove poter trovare interessanti tutorial avanazati su programmazione web.
Sito web: http://nettuts.com/…
The JavaScript Programming Language (by Douglas Crockford)
Yahoo! JavaScript Architect Douglas Crockford provides a comprehensive introduction to the JavaScript Programming Language in this four-part video:
…
<script>
var tempo=100;
var val=10;
var max=100;
var min=10;
function apri(){
setTimeout("aumenta()",tempo);
}
function chiudi(){
setTimeout("diminusci()",tempo);
}
function aumenta(){
if(val<=max){
val=val+10;
muovi(val);
apri();
}
}
function diminusci(){
if(val>=min){
val=val-10;
muovi(val);
chiudi();
}
}
function muovi(quanto){
oggetto=ObjById(‘cosa’);
oggetto.style.height=quanto;
}
function ObjById( id )
{
if (document.getElementById)
var returnVar = document.getElementById(id);
else if (document.all)
var returnVar = document.all[id];
else if (document.layers)
var returnVar = document.layers[id];
return returnVar;
}
</script>
<body>
<input type="button" value="apri" onclick="javascript:apri(val);">
<input type="button" value="chiudi" onclick="javascript:chiudi(val);">
<div id="cosa" style="background-color:red;">contenuto del blocco da sccrollare</div>…
In questo tutorial vedremo come creare un sistema simile a quello gi gmail per allegare i file alle email. Funziona che se si clicca su aggiungi altro file, appare un box con un input per allegare il file.
html
<input type="file" name="attachment" id="attachment" onchange="document.getElementById(‘moreUploadsLink’).style.display = ‘block’;" />
<div id="moreUploads"></div>
<div id="moreUploadsLink" style="display:none;"><a href="javascript:addFileInput();">Aggiungi altro file</a></div>
javascript
var upload_number = 2;
function addFileInput() {
var d = document.createElement("div");
var file = document.createElement("input");
file.setAttribute("type", "file");
file.setAttribute("name", "attachment"+upload_number);
d.appendChild(file);
document.getElementById("moreUploads").appendChild(d);
upload_number++;
} …
function f_scrollLeft() {
return f_filterResults (
window.pageXOffset ? window.pageXOffset : 0,
document.documentElement ? document.documentElement.scrollLeft : 0,
document.body ? document.body.scrollLeft : 0
);
}
function f_scrollTop() {
return f_filterResults (
window.pageYOffset ? window.pageYOffset : 0,
document.documentElement ? document.documentElement.scrollTop : 0,
document.body ? document.body.scrollTop : 0
);
}
function f_filterResults(n_win, n_docel, n_body) {
var n_result = n_win ? n_win : 0;
if (n_docel && (!n_result || (n_result > n_docel)))
n_result = n_docel;
return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}…
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = ‘*’;
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp(‘(^|\\s)’+searchClass+’(\\s|$)’);
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}…
function insertAtCursor(campo, stringa) {
if (document.selection) {
campo.focus();
sel = document.selection.createRange();
sel.text = stringa;
}
else if (campo.selectionStart || campo.selectionStart == ’0′) {
var startPos = campo.selectionStart;
var endPos = campo.selectionEnd;
campo.value = campo.value.substring(0, startPos)
+ stringa
+ campo.value.substring(endPos, campo.value.length);
} else {
campo.value += stringa;
}
}
che possiamo richiamare tramite:
insertAtCursor(document.formName.fieldName, ‘this value’);…
Creare il menu
La prima e più importante parte della realizzazione del nostro menu è la struttura stessa del menu. La cosa migliore da fare è creare un elenco non ordinato, con ogni sotto menu che a sua volta compare come elenco non ordinato all’interno della voce dell’elenco genitore. Suona complicato? Invece è davvero molto semplice:
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a>
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Offices</a></li>
</ul>
</li>
<li><a href="#">Services</a>
<ul>
<li><a href="#">Web Design</a></li>
<li><a href="#">Internet
Marketing</a></li>
<li><a href="#">Hosting</a></li>
<li><a href="#">Domain Names</a></li>
<li><a href="#">Broadband</a></li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">United Kingdom</a></li>
<li><a href="#">France</a></li>
<li><a href="#">USA</a></li>
<li><a href="#">Australia</a></li>
</ul>
</li>
</ul>
Continua a leggere su : http://www.gdesign.it/pages/howto/articoli/menuc/menuc.php…