Adding Java Script

  • Unknown's avatar

    I’m trying to add some Java Script to my page. How can I do that?

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar
    thistimethisspace · Member ·

    That’s not possible on this multiuser blogging platform as the software will strip the code out to preserve security. http://en.support.wordpress.com/code/

  • Unknown's avatar

    use tags <script> </script> and inside declare variables, arrays, and start programming; example that implements an album like with thumbnails, fotos, and comments about, the tito[]:

    <html><head>
    <title>novembro 1968 CPD unicamp</title></head>
    <script language=javascript>
    pref=”s”; posf=”.jpg”; min=0;
    colunas=1; incr=20; widTHUMB=100; //customizacao==
    colunas=4; incr=10; widTHUMB=50;
    colunas=1; incr=21; widTHUMB=110;
    colunas=2; incr=10; widTHUMB=80;
    h=3*widTHUMB/4; ////h=9*widTHUMB/10; h=widTHUMB;
    max=min+colunas*incr-1; fin=min-1;
    var ZEROS=””; if(min<10) ZEROS=”00″; else if(min<100) ZEROS=”0″;
    ini=ZEROS+min; NOBS=colunas*incr;
    var lista=new Array(); var ix=0; var tito=new Array(); it=0;
    var notas=new Array(); var ino=0; notas[ino++]=”1968 CPD unicamp”;
    notas[ino++]=”0:IBM1130 Zago Martinez Jensen Adami”;
    //////lista de fotos e titulos…
    lista[ix++]=”01.JPG”; tito[it++]=”1 Zago Martinez CarlosJensen Adami; IBM1130″;
    lista[ix++]=”02.JPG”; tito[it++]=”2 antigo Prédio do IMECC”;
    … other data…

    var NLIS=ix; NOBS=NLIS;
    for(ii=0; ii<NLIS; ii++) { jj=lista[ii].indexOf(“:”);
    notas[ii]=””;//ii.toString()+”:”+lista[ii].substring(jj);
    }

    var zoomPLUS=true; var WW,HH; var minW=160; var maxW=1028; var dW=200; var dH=200;
    </script>
    <body><center><DIV id=’bulle’ style=’position:absolute;top:5;left:5;’>
    <table border=0 cellspacing=”0″ cellpadding=”0″ width=”770″>
    <tr><td colspan=13 valign=top align=center>
    <script>
    var fig=pref+ZEROS+min+posf; fig=lista[0]; tit=notas[0];
    aux='<img name=”bigfoto” width=”820″ src=”‘+fig+'” title=”‘+tit+'”‘;
    aux+=’ onClick=”maxim()” onMouseOver=”t()”>’; //alert(aux);
    document.write(aux); MAX=min+colunas*incr; //alert(“MAX=”+MAX);
    document.write(‘<td valign=top><table border=0 cellspacing=”0″ cellpadding=”0″ width=30%>’);
    for(var ini=min; ini<max; ini=ini+colunas) { fin+=colunas;
    document.write(‘<tr><td valign=top><table border=0 cellspacing=”0″ cellpadding=”0″>’);
    for(ix=ini; ix<=fin; ix++) {
    fig=lista[ix]; vixi=”ge(‘”+fig+”‘)”;
    tit=’ title=”‘+fig; //sem ix:fig[n]notas
    marca=” bgcolor=yellow “; marca=””;
    if(notas[ix].length>0) { //xx//marca=” bgcolor=red “;
    ob=notas[ix]; tit+=”n”+ob; ob=ob.replace(“n”,” “);
    vixi=”ge(‘”+lista[ix]+”==”+ob+”‘)”;
    }
    if(tito[ix].length>0) tit=’ title=”‘+tito[ix]+'” width=”‘+widTHUMB+’ height=”‘+h+'” ‘;
    else tit+='” width=”‘+widTHUMB+’ height=”‘+h+'” ‘;
    H='<td height=”‘+h+'”>’;
    aux=H+’ ‘+H+'<img vspace=1 src=”‘+fig+'” ‘+tit+'[‘+vixi+’ onClick=”‘+vixi+'”>’;
    document.write(aux);
    }
    document.write(‘</table>n’);
    }
    document.write(‘</table>n’);
    document.write(‘</table>n</table>’);
    </script>
    </center></div>

    <script>

    function ge(xtit) { var jj=xtit.indexOf(“==”); var L=xtit.length;
    var tit=xtit.substr(jj+2,L-jj); //alert(L);
    var aux=xtit.substr(0,jj); if(tit==undefined) tit=””;
    this.bigfoto.src=xtit; this.bigfoto.title=aux;//aux.replace(“.JPG”,”xxxx”);
    window.status=”ge:”+this.bigfoto.width+”,”+this.bigfoto.height+xtit;
    }
    function t() {
    with(this.bigfoto) { window.status=width+”,”+height; }
    }
    function maxim() {
    with(this.bigfoto) {
    if((width <= maxW-dW) && zoomPLUS) { width+=dW; }
    else { dW=200; dH=dW*height/width; width-=dW; zoomPLUS=false; }
    window.status=”plus:”+width+”,”+height;
    }
    }
    function minim() {
    with(this.bigfoto) {
    if(width >= (minW+dW-1)) { width-=dW; w=width; h=height; }
    else { width+=dW; //zoomPLUS=false;
    }
    w=this.bigfoto.width; h=this.bigfoto.height;
    window.status=”auto:”+w+”,”+h; //WW=w; HH=h;
    }
    }
    </script>
    </body></html>

  • Unknown's avatar
    thistimethisspace · Member ·

    What purpose do you assume posting that here serves? That’s not a free hosted WordPress.com blog linked to your username. We provide support here only for free hosted WordPress.COM blogs. You are posting to the wrong support forum and we can’t help you here. If you don’t have a username account at WordPress.org click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there and receive advice from WordPress.org bloggers.

  • Unknown's avatar

    @paltonio, did you happen to read the link that timethief provided? We can’t use script here at WordPress.com.

  • The topic ‘Adding Java Script’ is closed to new replies.