15000 tutorials per photoshop

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

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/
In questo articolo vedremo come modificare lo stile css di una pagina web con uno script javascript. Nella pagina html, avremo l'elenco degli stili:
...
<link rel="stylesheet" type="text/css" href="stile1.css" title="stile1" />
<link rel="alternate stylesheet" type="text/css" href="stile2.css" title="stile2" />
...
e oltre al resto della pagina, la chiamata al file javascript:
<script type="text/javascript" src="switcher.js"></script>
cosi impostato:
/* Style Switcher by Paul Sowden, see A List Apart: http://www.alistapart.com/articles/alternate/ */
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
}
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
document.writeln("<div id=\"textsize\">Passa a stile1: <a href=\"#\" onclick=\"setActiveStyleSheet('stile1'); return false;\" id=\"stile1\">Stile1</a><a href=\"#\" onclick=\"setActiveStyleSheet('stile2'); return false;\" id=\"stile2\">Passa a stile2</a></div>");

Se volete comprimere file javascript, bananascript.com fà al caso vostro. Permette di ridurre di tanto la dimensione di un file javascript.
Sito web: http://www.bananascript.com/
In questo articolo vedremo come mostrare un elemento div alle coordinate del mouse. Supponiamo di avere un div con id divColor in posizione 155,355, e vogliamo che prenda la posizione del mouse
function ShowDivAtPoint(id){
var x=event.x; //Cordinata X del Mouse
var y=event.y; //Cordinata Y del Mouse
var doc=document.getElementById(id);
doc.style.left=x;
doc.style.top=y;
}
che richiameremo con
ShowDivAtPoint('divColor')

In questo tutorial vedremo come evidenziare delle parole di un testo direttamente da javascript, passandogli attraverso la querystring al parola da evidenziare.
File contenente il testo
Come prima cosa creiamo o modifichiamo il nostro file che per comodità ho preso essere html. Definiamo una classe css che setta lo stile dell'evidenziamento:
<style>
.searchword{
background-color:yellow;
}
</style>
e poi richiamiamo lo script javascript che si occuperà di fare tutto il lavoro:
<script src="searchhi.js"></script>
File javascript
/* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20070316 to stop highlighting inside nosearchhi nodes */
/* Modificato 19 gennaio 2008 da sandro stracuzzi - sandrostracuzzi@hotmail.com */
function highlightWord(node,word) {
// Iterate into this nodes childNodes
if (node.hasChildNodes) {
var hi_cn;
for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {
highlightWord(node.childNodes[hi_cn],word);
}
}
// And do this node itself
if (node.nodeType == 3) { // text node
tempNodeVal = node.nodeValue.toLowerCase();
tempWordVal = word.toLowerCase();
if (tempNodeVal.indexOf(tempWordVal) != -1) {
pn = node.parentNode;
// check if we're inside a "nosearchhi" zone
checkn = pn;
while (checkn.nodeType != 9 &&
checkn.nodeName.toLowerCase() != 'body') {
// 9 = top of doc
if (checkn.className.match(/\bnosearchhi\b/)) { return; }
checkn = checkn.parentNode;
}
if (pn.className != "searchword") {
// word has not already been highlighted!
nv = node.nodeValue;
ni = tempNodeVal.indexOf(tempWordVal);
// Create a load of replacement nodes
before = document.createTextNode(nv.substr(0,ni));
docWordVal = nv.substr(ni,word.length);
after = document.createTextNode(nv.substr(ni+word.length));
hiwordtext = document.createTextNode(docWordVal);
hiword = document.createElement("span");
hiword.className = "searchword";
hiword.appendChild(hiwordtext);
pn.insertBefore(before,node);
pn.insertBefore(hiword,node);
pn.insertBefore(after,node);
pn.removeChild(node);
}
}
}
}
function googleSearchHighlight() {
var q = location.search;
var q = q.replace("?q=","")
highlightWord(document.getElementsByTagName("body")[0],q);
}
window.onload = googleSearchHighlight;
Funzionamento
Basta richiamare il nome del file passandogli alla variabile q nella querystring il valore da cercare e il gioco è fatto. Ad esempio:
ricerca.html?q=prova
Dove ricerca,html è il file html di cui parlavamo all'inizio
| Proprietà - CSS | Referenza - JavaScript |
| background | background |
| background-attachment | backgroundAttachment |
| background-color | backgroundColor |
| background-image | backgroundImage |
| background-position | backgroundPosition |
| background-repeat | backgroundRepeat |
| border | border |
| border-bottom | borderBottom |
| border-bottom-color | borderBottomColor |
| border-bottom-style | borderBottomStyle |
| border-bottom-width | borderBottomWidth |
| border-color | borderColor |
| border-left | borderLeft |
| border-left-color | borderLeftColor |
| border-left-style | borderLeftStyle |
| border-left-width | borderLeftWidth |
| border-right | borderRight |
| border-right-color | borderRightColor |
| border-right-style | borderRightStyle |
| border-right-width | borderRightWidth |
| border-style | borderStyle |
| border-top | borderTop |
| border-top-color | borderTopColor |
| border-top-style | borderTopStyle |
| border-top-width | borderTopWidth |
| border-width | borderWidth |
| clear | clear |
| clip | clip |
| color | color |
| cursor | cursor |
| display | display |
| filter | filter |
| font | font |
| font-family | fontFamily |
| font-size | fontSize |
| font-variant | fontVariant |
| font-weight | fontWeight |
| height | height |
| left | left |
| letter-spacing | letterSpacing |
| line-height | lineHeight |
| list-style | listStyle |
| list-style-image | listStyleImage |
| list-style-position | listStylePosition |
| list-style-type | listStyleType |
| margin | margin |
| margin-bottom | marginBottom |
| margin-left | marginLeft |
| margin-right | marginRight |
| margin-top | marginTop |
| overflow | overflow |
| padding | padding |
| padding-bottom | paddingBottom |
| padding-left | paddingLeft |
| padding-right | paddingRight |
| padding-top | paddingTop |
| page-break-after | pageBreakAfter |
| page-break-before | pageBreakBefore |
| position | position |
| float | styleFloat |
| text-align | textAlign |
| text-decoration | textDecoration |
| text-decoration: blink | textDecorationBlink |
| text-decoration: line-through | textDecorationLineThrough |
| text-decoration: none | textDecorationNone |
| text-decoration: overline | textDecorationOverline |
| text-decoration: underline | textDecorationUnderline |
| text-indent | textIndent |
| text-transform | textTransform |
| top | top |
| vertical-align | verticalAlign |
| visibility | visibility |
| width | width |
| z-index | zIndex |