Javascript navegador...

Hardware, software, nuevas tecnologías y todo lo que entre en el mundo de la computación y la red de redes...
Xavi
Una vez más, cortando las hojas
Una vez más, cortando las hojas
Mensajes: 3553
Registrado: Mié Nov 12, 2008 2:50 am

Javascript navegador...

Mensajepor Xavi »

Pues quería pedir ayuda porque quiero colocar un código javascript en la barra del navegador, el problema es que me lo busca en google en lugar de ponerlo en práctica, ¿qué tengo hacer para que haga lo que quiero?

Darkprotoman=^-^=
Hacia la Calle Victoria Hoenn
Hacia la Calle Victoria Hoenn
Mensajes: 1080
Registrado: Jue Jul 17, 2008 3:25 pm

Re: Javascript navegador...

Mensajepor Darkprotoman=^-^= »

Xavi escribió:Pues quería pedir ayuda porque quiero colocar un código javascript en la barra del navegador, el problema es que me lo busca en google en lugar de ponerlo en práctica, ¿qué tengo hacer para que haga lo que quiero?




1.-JS va centrado a los objetos ya creados(imagen), por ejemplo en una página de internet a un objeto determinado al dar clic este pude desplegarse (este sería el código de Acordeón)

Por ejemplo

Código: Seleccionar todo

(function(){if(typeof Spry=="undefined")window.Spry={};if(!Spry.Utils)Spry.Utils={};Spry.$=function(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push(Spry.$(arguments[b]));return c}typeof a=="string"&&(a=document.getElementById(a));return a};Spry.Utils.getAttribute=function(a,b){a=Spry.$(a);if(!a||!b)return null;try{var c=a.getAttribute(b)}catch(d){}if(c==void 0&&b.search(/:/)!=-1)try{c=a.getAttribute(b.replace(/:/,""))}catch(e){}return c};Spry.Utils.setAttribute=function(a,
b,c){if((a=Spry.$(a))&&b)if(b=="class")a.className=c;else{try{a.setAttribute(b,c)}catch(d){}b.search(/:/)!=-1&&a.getAttribute(b)==void 0&&a.setAttribute(b.replace(/:/,""),c)}};Spry.Utils.removeAttribute=function(a,b){if((a=Spry.$(a))&&b){try{a.removeAttribute(b)}catch(c){}b.search(/:/)!=-1&&a.removeAttribute(b.replace(/:/,""));b=="class"&&a.removeAttribute("className")}};Spry.Utils.addClassName=function(a,b){(a=Spry.$(a))&&b&&!(a.className&&a.className.search(RegExp("\\b"+b+"\\b"))!=-1)&&(a.className+=
(a.className?" ":"")+b)};Spry.Utils.removeClassName=function(a,b){a=Spry.$(a);if(Spry.Utils.hasClassName(a,b))a.className=a.className.replace(RegExp("\\s*\\b"+b+"\\b","g"),"")};Spry.Utils.toggleClassName=function(a,b){Spry.Utils.hasClassName(a,b)?Spry.Utils.removeClassName(a,b):Spry.Utils.addClassName(a,b)};Spry.Utils.hasClassName=function(a,b){a=Spry.$(a);if(!a||!b||!a.className||a.className.search(RegExp("\\b"+b+"\\b"))==-1)return!1;return!0};Spry.Utils.camelizeString=function(a){for(var b="",a=
a.split("-"),c=0;c<a.length;c++){var d=a[c];d&&(b=b?b+d.charAt(0).toUpperCase()+d.substring(1):d)}return b};Spry.Utils.styleStringToObject=function(a){var b={};if(a)for(var a=a.split(";"),c=0;c<a.length;c++){var d=a[c];if(d&&d.indexOf(":")!=-1){var e=d.split(":"),d=e[0].replace(/^\s*|\s*$/g,""),e=e[1].replace(/^\s*|\s*$/g,"");d&&e&&(b[Spry.Utils.camelizeString(d)]=e)}}return b};Spry.Utils.addEventListener=function(a,b,c,d){try{Spry.Utils.eventListenerIsBoundToElement(a,b,c,d)||(a=Spry.$(a),c=Spry.Utils.bindEventListenerToElement(a,
b,c,d),a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c))}catch(e){}};Spry.Utils.removeEventListener=function(a,b,c,d){try{a=Spry.$(a),c=Spry.Utils.unbindEventListenerFromElement(a,b,c,d),a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)}catch(e){}};Spry.Utils.eventListenerHash={};Spry.Utils.nextEventListenerID=1;Spry.Utils.getHashForElementAndHandler=function(a,b,c,d){var e=null;if(a=Spry.$(a)){if(typeof a.spryEventListenerID==
"undefined")a.spryEventListenerID="e"+Spry.Utils.nextEventListenerID++;if(typeof c.spryEventHandlerID=="undefined")c.spryEventHandlerID="h"+Spry.Utils.nextEventListenerID++;e=a.spryEventListenerID+"-"+c.spryEventHandlerID+"-"+b+(d?"-capture":"")}return e};Spry.Utils.eventListenerIsBoundToElement=function(a,b,c,d){a=Spry.$(a);a=Spry.Utils.getHashForElementAndHandler(a,b,c,d);return Spry.Utils.eventListenerHash[a]!=void 0};Spry.Utils.bindEventListenerToElement=function(a,b,c,d){a=Spry.$(a);b=Spry.Utils.getHashForElementAndHandler(a,
b,c,d);if(Spry.Utils.eventListenerHash[b])return Spry.Utils.eventListenerHash[b];return Spry.Utils.eventListenerHash[b]=function(b){b=b||window.event;if(!b.preventDefault)b.preventDefault=function(){this.returnValue=!1};if(!b.stopPropagation)b.stopPropagation=function(){this.cancelBubble=!0};var d=c.call(a,b);d==!1&&(b.preventDefault(),b.stopPropagation());return d}};Spry.Utils.unbindEventListenerFromElement=function(a,b,c,d){a=Spry.$(a);a=Spry.Utils.getHashForElementAndHandler(a,b,c,d);Spry.Utils.eventListenerHash[a]&&
(c=Spry.Utils.eventListenerHash[a],Spry.Utils.eventListenerHash[a]=void 0);return c};Spry.Utils.cancelEvent=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;return!1};Spry.Utils.addLoadListener=function(a){typeof window.addEventListener!="undefined"?window.addEventListener("load",a,!1):typeof document.addEventListener!="undefined"?document.addEventListener("load",a,!1):typeof window.attachEvent!="undefined"&&window.attachEvent("onload",
a)};Spry.Utils.isDescendant=function(a,b){if(a&&b)for(b=b.parentNode;b;){if(a==b)return!0;b=b.parentNode}return!1};Spry.Utils.getAncestor=function(a,b){if(a=Spry.$(a)){var c=Spry.$$.tokenizeSequence(b?b:"*")[0];if(c=c?c[0]:null)for(var d=a.parentNode;d;){if(c.match(d))return d;d=d.parentNode}}return null};Spry.Utils.preorderTraversal=function(a,b){var c=!1;if(a&&(c=b(a),a.hasChildNodes()))for(var d=a.firstChild;!c&&d;){c=Spry.Utils.preorderTraversal(d,b);try{d=d.nextSibling}catch(e){d=null}}return c};
Spry.$$=function(a,b){var c=[];Spry.$$.addExtensions(c);if(typeof arguments[0]=="object"){for(var d=0;d<arguments.length;d++)arguments[d].constructor==Array?c.push.apply(c,arguments[d]):c.push(arguments[d]);return c}var b=b?Spry.$(b):document,e=Spry.$$.tokenizeSequence(a);++Spry.$$.queryID;for(var f=0,g=e.length,d=0;d<g;d++)for(var h=Spry.$$.processTokens(e[d],b),i=h.length,j=0;j<i;j++){var k=h[j];if(!k.spry$$ID)k.spry$$ID=++f,c.push(k)}i=c.length;for(d=0;d<i;d++)c[d].spry$$ID=void 0;return c};Spry.$$.cache=
{};Spry.$$.queryID=0;Spry.$$.Token=function(){this.type=Spry.$$.Token.SELECTOR;this.name="*";this.id="";this.classes=[];this.attrs=[];this.pseudos=[]};Spry.$$.Token.Attr=function(a,b){this.name=a;this.value=b?RegExp(b):void 0};Spry.$$.Token.PseudoClass=function(a){this.name=a.replace(/\(.*/,"");this.arg=a.replace(/^[^\(\)]*\(?\s*|\)\s*$/g,"");this.func=Spry.$$.pseudoFuncs[this.name]};Spry.$$.Token.SELECTOR=0;Spry.$$.Token.COMBINATOR=1;Spry.$$.Token.prototype.match=function(a,b){if(this.type==Spry.$$.Token.COMBINATOR)return!1;
if(!b&&this.name!="*"&&this.name!=a.nodeName.toLowerCase())return!1;if(this.id&&this.id!=a.id)return!1;for(var c=this.classes,d=c.length,e=0;e<d;e++)if(!a.className||!c[e].value.test(a.className))return!1;c=this.attrs;d=c.length;for(e=0;e<d;e++){var f=c[e],g=a.attributes.getNamedItem(f.name);if(!g||!f.value&&g.nodeValue==void 0||f.value&&!f.value.test(g.nodeValue))return!1}c=this.pseudos;d=c.length;for(e=0;e<d;e++)if((f=c[e])&&f.func&&!f.func(f.arg,a,this))return!1;return!0};Spry.$$.Token.prototype.getNodeNameIfTypeMatches=
function(a){a=a.nodeName.toLowerCase();if(this.name!="*"){if(this.name!=a)return null;return this.name}return a};Spry.$$.escapeRegExpCharsRE=/\/|\.|\*|\+|\(|\)|\[|\]|\{|\}|\\|\|/g;Spry.$$.tokenizeSequence=function(a){var b=Spry.$$.cache[a];if(b)return b;var b=/(\[[^\"'~\^\$\*\|\]=]+([~\^\$\*\|]?=\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\])|((:[^\.#:\s,>~\+\[\]]+\(([^\(\)]+|\([^\(\)]*\))*\))|[\.#:]?[^\.#:\s,>~\+\[\]]+)|(\s*[\s,>~\+]\s*)/g,c=new Spry.$$.Token,d=[];d.push(c);var e=[];e.push(d);for(var a=a.replace(/^\s*|\s*$/,
""),f=b.exec(a);f;){f=f[0];switch(f.charAt(0)){case ".":c.classes.push(new Spry.$$.Token.Attr("class","\\b"+f.substr(1)+"\\b"));break;case "#":c.id=f.substr(1);break;case ":":c.pseudos.push(new Spry.$$.Token.PseudoClass(f));break;case "[":var g=f.match(/\[([^\"'~\^\$\*\|\]=]+)(([~\^\$\*\|]?=)\s*('[^']*'|"[^"]*"|[^"'\]]+))?\s*\]/),f=g[1],h=g[3];if(g=g[4])g=g.replace(/^['"]|['"]$/g,""),g=g.replace(Spry.$$.escapeRegExpCharsRE,"\\$&");var i=void 0;switch(h){case "=":i="^"+g+"$";break;case "^=":i="^"+
g;break;case "$=":i=g+"$";break;case "~=":case "|=":i="\\b"+g+"\\b";break;case "*=":i=g}c.attrs.push(new Spry.$$.Token.Attr(f,i));break;default:(h=f.match(/^\s*([\s,~>\+])\s*$/))?(h[1]==","?(d=[],e.push(d)):(c=new Spry.$$.Token,c.type=Spry.$$.Token.COMBINATOR,c.name=h[1],d.push(c)),c=new Spry.$$.Token,d.push(c)):c.name=f.toLowerCase()}f=b.exec(a)}return Spry.$$.cache[a]=e};Spry.$$.combinatorFuncs={" ":function(a,b){for(var c=++Spry.$$.uniqueID,d=[],e=a.length,f=0;f<e;f++)if(c!=a[f].spry$$uid)for(var g=
a[f].getElementsByTagName(b.name),h=g.length,i=0;i<h;i++){var j=g[i];j.nodeType==1&&b.match(j,!0)&&d.push(j);j.spry$$uid=c}return d},">":function(a,b){for(var c=[],d=a.length,e=0;e<d;e++)for(var f=a[e].firstChild;f;)f.nodeType==1&&b.match(f)&&c.push(f),f=f.nextSibling;return c},"+":function(a,b){for(var c=[],d=a.length,e=0;e<d;e++){for(var f=a[e].nextSibling;f&&f.nodeType!=1;)f=f.nextSibling;f&&b.match(f)&&c.push(f)}return c},"~":function(a,b){for(var c=++Spry.$$.uniqueID,d=[],e=a.length,f=0;f<e;f++)for(var g=
a[f].nextSibling;g;){if(g.nodeType==1){if(c==g.spry$$uid)break;if(b.match(g))d.push(g),g.spry$$uid=c}g=g.nextSibling}return d}};Spry.$$.uniqueID=0;Spry.$$.pseudoFuncs={":first-child":function(a,b){for(var c=b.previousSibling;c;){if(c.nodeType==1)return!1;c=c.previousSibling}return!0},":last-child":function(a,b){for(var c=b.nextSibling;c;){if(c.nodeType==1)return!1;c=c.nextSibling}return!0},":empty":function(a,b){for(var c=b.firstChild;c;){switch(c.nodeType){case 1:case 3:case 4:case 5:return!1}c=
c.nextSibling}return!0},":nth-child":function(a,b,c){return Spry.$$.nthChild(a,b,c)},":nth-last-child":function(a,b,c){return Spry.$$.nthChild(a,b,c,!0)},":nth-of-type":function(a,b,c){return Spry.$$.nthChild(a,b,c,!1,!0)},":nth-last-of-type":function(a,b,c){return Spry.$$.nthChild(a,b,c,!0,!0)},":first-of-type":function(a,b,c){a=c.getNodeNameIfTypeMatches(b);if(!a)return!1;for(b=b.previousSibling;b;){if(b.nodeType==1&&a==b.nodeName.toLowerCase())return!1;b=b.previousSibling}return!0},":last-of-type":function(a,
b,c){a=c.getNodeNameIfTypeMatches(b);if(!a)return!1;for(b=b.nextSibling;b;){if(b.nodeType==1&&a==b.nodeName.toLowerCase())return!1;b=b.nextSibling}return!0},":only-child":function(a,b,c){var d=Spry.$$.pseudoFuncs;return d[":first-child"](a,b,c)&&d[":last-child"](a,b,c)},":only-of-type":function(a,b,c){var d=Spry.$$.pseudoFuncs;return d[":first-of-type"](a,b,c)&&d[":last-of-type"](a,b,c)},":not":function(a,b){var c=Spry.$$.tokenizeSequence(a)[0],c=c?c[0]:null;return!c||!c.match(b)},":enabled":function(a,
b){return!b.disabled},":disabled":function(a,b){return b.disabled},":checked":function(a,b){return b.checked},":root":function(a,b){return b.parentNode&&b.ownerDocument&&b.parentNode==b.ownerDocument}};Spry.$$.nthRegExp=/((-|[0-9]+)?n)?([+-]?[0-9]*)/;Spry.$$.nthCache={even:{a:2,b:0,mode:1,invalid:!1},odd:{a:2,b:1,mode:1,invalid:!1},"2n":{a:2,b:0,mode:1,invalid:!1},"2n+1":{a:2,b:1,mode:1,invalid:!1}};Spry.$$.parseNthChildString=function(a){var b=Spry.$$.nthCache[a];if(!b){var c=a.match(Spry.$$.nthRegExp),
b=c[1],d=c[2],c=c[3],d=d?d=="-"?-1:parseInt(d,10):b?1:0,c=c?parseInt(c,10):0,e=d==0?0:d>0?1:-1,f=!1;d>0&&c<0?(c%=d,c=(c%=d)<0?d+c:c):d<0&&(c<0?f=!0:d=Math.abs(d));b={};b.a=d;b.b=c;b.mode=e;b.invalid=f;Spry.$$.nthCache[a]=b}return b};Spry.$$.nthChild=function(a,b,c,d,e){if(e){var f=c.getNodeNameIfTypeMatches(b);if(!f)return!1}a=Spry.$$.parseNthChildString(a);if(a.invalid)return!1;var g="spry$$ncQueryID",c="spry$$ncPos",h="spry$$ncCount";e&&(g+=f,c+=f,h+=f);var i=b.parentNode;if(i[g]!=Spry.$$.queryID){var j=
0;i[g]=Spry.$$.queryID;for(g=i.firstChild;g;){if(g.nodeType==1&&(!e||f==g.nodeName.toLowerCase()))g[c]=++j;g=g.nextSibling}i[h]=j}j=b[c];d&&(j=i[h]-j+1);if(a.mode==0)return j==a.b;if(a.mode>0)return j<a.b?!1:!((j-a.b)%a.a);return j>a.b?!1:!((a.b-j)%a.a)};Spry.$$.processTokens=function(a,b){for(var c=a.length,d=[b],e=null,f=0;f<c&&d.length>0;f++){var g=a[f];g.type==Spry.$$.Token.SELECTOR?e?(d=e(d,g),e=null):d=Spry.$$.getMatchingElements(d,g):e=Spry.$$.combinatorFuncs[g.name]}return d};Spry.$$.getMatchingElements=
function(a,b){var c=[];if(b.id&&(f=a[0])&&f.ownerDocument)return(f=f.ownerDocument.getElementById(b.id))&&b.match(f)&&c.push(f),c;for(var d=a.length,e=0;e<d;e++)for(var f=a[e],g=f.getElementsByTagName(b.name),h=g.length,i=0;i<h;i++)f=g[i],f.nodeType==1&&b.match(f,!0)&&c.push(f);return c};Spry.$$.addExtensions=function(a){for(var b in Spry.$$.Results)a[b]=Spry.$$.Results[b]};Spry.$$.Results={};Spry.$$.Results.forEach=function(a){for(var b=this.length,c=0;c<b;c++)a(this[c]);return this};Spry.$$.Results.setAttribute=
function(a,b){return this.forEach(function(c){Spry.Utils.setAttribute(c,a,b)})};Spry.$$.Results.removeAttribute=function(a){return this.forEach(function(b){Spry.Utils.removeAttribute(b,a)})};Spry.$$.Results.addClassName=function(a){return this.forEach(function(b){Spry.Utils.addClassName(b,a)})};Spry.$$.Results.removeClassName=function(a){return this.forEach(function(b){Spry.Utils.removeClassName(b,a)})};Spry.$$.Results.toggleClassName=function(a){return this.forEach(function(b){Spry.Utils.toggleClassName(b,
a)})};Spry.$$.Results.addEventListener=function(a,b,c,d){return this.forEach(function(e){Spry.Utils.addEventListener(e,a,b,c,d)})};Spry.$$.Results.removeEventListener=function(a,b,c){return this.forEach(function(d){Spry.Utils.removeEventListener(d,a,b,c)})};Spry.$$.Results.setStyle=function(a){a&&(a=Spry.Utils.styleStringToObject(a),this.forEach(function(b){for(var c in a)try{b.style[c]=a[c]}catch(d){}}));return this};Spry.$$.Results.setProperty=function(a,b){if(a){if(typeof a=="string"){var c={};
c[a]=b;a=c}this.forEach(function(b){for(var c in a)try{b[c]=a[c]}catch(f){}})}return this}})();


Esto hace que una un menú se despliegue de modo acordeón, dejando adentro opciones para llevar a otra página

http://img853.imageshack.us/img853/917/alf1c.png
http://img848.imageshack.us/img848/7584/alf2.png
Imagen

¿Qué cuánto anime he visto?, revisa el spoiler
Spoiler: Mostrar
ImagenImagenImagen

Más firmas
Spoiler: Mostrar
Imagen
Imagen
Imagen
Imagen
Imagen
Imagen
ImagenImagenImagen
Imagen
Imagen
Imagen