|
| TEMARIO ANTERIOR | Principal| |
Is interesting the idea of this JavasCript Browser due to many issues, the first, cause can help who can not have a server to run a data base server, or have a free service, or just simply doing a big select on PHP MySQL that allow the end user to made subselects, avoiding trafic and server resources with code and queries to a server DB, on this way the Client Browser is more helpful with the server. This script was tested with Firefox, Mozilla and Konqueror, It was not tested with Internet Explorer, cause is not being used anymore due to security issues (MAY BE CAN WORK) I don't have IE since a lot of years.
IDEA AND MOTIVATIONWas upon a time an age that Internet access was an expensive and temporal resource, then, we can�t provide offline dynamic content so easy, many enterprices was used a propietary software on theri CD-ROMs that runs on Client PC a Proxy and a Fake DNS,I don't remember today the name but I was being forced to do my own, on this way a little web server execute querys trow CGI over catalogs and lists. Once in too many igenous HTML catalogs, I saw an original idea, put the whole text onto a big array and hide/unhide layers. Well having so many back to my one, we make an Object about many keys and descriptions, and we put this Object onto a big array, but there is just only 1 layer, that is filled or regenerated with a table, then so we can put the browser anyway on the web page like the right example, and modify the code to show the resultset in 2 columns instead of 5.
DONWLOAD THE ZIP FILE WITH 3 EXAMPLE FILES and PICTURES ~ 500k |
SELECT A TOPIC TO SEARCHTry [recamara] and guess the others. |
/* This version of JavaScript Calendar can be used by anyone who is not intented
to do profit directly with this code, it means you can not sale the code as is,
you can use it ont your web or php project, or put in a CD Magazine, if you really
do profit with your project and my code consider sharing them :P.
If you want to include the calendar in some web editor, do not remove this legend.
The lastest version can be found at
http://www.compunauta.com/forums/linux/programacion/java/gus_browser.html
This is Open and Free Software, madgus@gmail.com, gustavo@compunauta.com
*/
var CLAVE=0;
var DESCR=1;
var COMEN=2;
var PRICE=3;
var gus_Listado = new Array();
var array_pointer = 0;
function addObject(Clave,Descripcion,Comentario,Precio){
var newObject=new Array(3);
newObject[CLAVE]=Clave;
newObject[DESCR]=Descripcion;
newObject[COMEN]=Comentario;
//newObject[PRICE]=Precio;
gus_Listado[array_pointer++]=newObject;
}
function doSearch(FormName,LayerName,FieldName){
var innerTMP="";
var layer = document.getElementById(LayerName);
var query = document.forms[FormName].elements[FieldName].value.toUpperCase();
layer.innerHTML="";
if (query.length==0){
layer.innerHTML+="<H3>BUSQUEDA VACIA</H3>";
return false;}
var items=0;
var mcols=5;
var pcols=(Math.round(100/mcols));
var cols=0;
var res=0;
innerTMP+="<table align=\"center\" cellpadding=\"5\" width=\"95%\">";
for (var i=0; i<array_pointer; i++){
if((gus_Listado[i][DESCR].toUpperCase().indexOf(query)!=-1) || (gus_Listado[i][CLAVE].toUpperCase().indexOf(query)!=-1) ||
(gus_Listado[i][COMEN].toUpperCase().indexOf(query)!=-1)){
res++;
if(cols==0){innerTMP+="<tr>";}
if(cols==mcols){cols=0;innerTMP+="</tr>\n";}
cols++;
innerTMP+="<td width=\""+pcols+"%\" align=\"center\" border='2'>";
innerTMP+="<b><H3>"+gus_Listado[i][COMEN]+"</H3></b>";
innerTMP+="<A href='img/"+gus_Listado[i][CLAVE].toLowerCase()+".jpg' target='_blank'><IMG SRC='img/"+gus_Listado[i][CLAVE].toLowerCase()+".jpg' width='50' height='50' border='1' alt='"+gus_Listado[i][CLAVE].toLowerCase()+".jpg'></A><br>";
innerTMP+="<i>"+gus_Listado[i][DESCR]+"</i><br>";
innerTMP+="C:<b>"+gus_Listado[i][CLAVE]+"</b>";
innerTMP+="</td>";
}
}
innerTMP+="</table>";
if(res>0){layer.innerHTML=innerTMP;}
else{layer.innerHTML="<H3>BUSQUEDA SIN RESULTADOS</H3>";}
return false;
}