Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. giangi56
    3. Post
    G

    giangi56

    @giangi56

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 1
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    Età 69
    0
    Reputazione
    1
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da giangi56

    • conflitto script

      2 script in stessa pagina
      salve a tutti premetto che sono un autodidatta che si diletta a scoprire piano piano tutti i segreti per la costruzione di pagine web
      adesso però sono da un po di tempo ( 2 mesi) di fronte ad un problema che faccio fatica a risolvere ( nonostante abbia acquistato anche un paio di manuali)
      vorrei inserire nella stessa pagina due script js che ho trovato sul sito dhteumeuleu però non funzionano, o meglio se ne inserisco solo uno tutto ok altrimenti con tutti e due ne funziona solo uno.
      avrei proprio bisogno di una dritta sul come eliminare questo conflitto grazie anticipato
      giovanni

      entrambi gli script sono nella cartella js e li richiamo cosi
      <script src="js/provarose.js"></script>
      <script src="js/provamenu.js"></script>

      questo è lo script che uso per il menu chiamato provamenu

      
      var object = new Array();
      
      function Slide(N,oCont){
      this.N = N;
      this.S = 1.1;
      this.object = new Array();
      
      this.CObj = function (parent,N){
      
      this.parent = parent;
      this.N = N;
      this.obj = parent.frm;
      this.tit = this.obj.firstChild;
      this.div = this.obj.getElementsByTagName("div")[1];
      this.div.style.visibility = "hidden";
      this.y0 = N * 18;
      this.Y1 = this.y0;
      this.obj.style.top = Math.round(this.y0) + 'px';
      this.obj.style.height = Math.round(parent.H - (parent.NF-1) * 18 - 3) + 'px';
      this.obj.style.visibility = "visible";
      this.obj.parent = this;
      this.run = false;
      
      this.move = function(){
      with(this){
      dy = (y1-y0)/parent.S;
      if(Math.abs(dy)>.1){
      y0+=dy;
      obj.style.top = Math.round(y0) + 'px';;
      setTimeout("object["+parent.N+"].object["+N+"].move();", 16);
      } else {
      run = false;
      if(dy>0)div.style.visibility="hidden";
      else if(N>0)parent.object[N-1].div.style.visibility="hidden";
      }
      }
      }
      
      this.obj.onmouseover = function(){
      with(this.parent){
      if(!run){
      run = true;
      div.style.visibility="visible";
      for(i=0;i<parent.NF;i++)parent.object*.tit.className = "title";
      tit.className = "title_o";
      for(i=0;i<=N;i++){
      parent.object*.y1 = i*18;
      parent.object*.move();
      }
      for(i=N+1;i<parent.NF;i++){
      parent.object*.y1 = parent.H-(parent.NF-i)*18;
      parent.object*.move();
      }
      }
      }
      }
      }
      
      this.frm = document.getElementById(oCont);
      this.H = this.frm.offsetHeight;
      this.frm = this.frm.getElementsByTagName("span");
      this.NF = this.frm.length;
      for(i=0; i < this.NF; i++) this.object* = new this.CObj(this, i);
      this.object[0].obj.onmouseover();
      this.S = 10;
      }
      
      onload = function() {
      object[0] = new Slide(0, "frames");
      }
      
      

      questo invece per il richiamo ad alcune altre pagine chiamato provarose

      
      document.onselectstart = new Function("return false");
      O = new Array();
      box = 0;
      img = 0;
      txt = 0;
      tit = 0;
      W = 0;
      H = 0;
      nI = 0;
      sel = 0;
      si = 0;
      ZOOM = 0;
      rImg = 0;
      //////////////////
      speed = .04; // animation speed
      delay = .5; // 1 = no delay
      //////////////////
      
      function dText(){
      txt.style.textAlign = tit.style.textAlign = (sel<nI/2)?"left":"right";
      txt.innerHTML = O[sel].tx;
      tit.innerHTML = O[sel].ti;
      }
      
      function CObj(n, s, x, tx, ti){
      this.n = n;
      this.dim = s;
      this.tx = tx;
      this.ti = ti;
      this.is = img;
      this.vz = 0;
      this.sx = 0;
      this.x0 = x;
      this.x1 = 0;
      this.zo = 0;
      this.over = function() {
      with(this){
      if(n!=sel){
      O[sel].dim = 100;
      O.dim = ZOOM * 100;
      sel = n;
      l = 0;
      for(k=0; k<nI; k++){
      O[k].x0 = l;
      l += O[k].dim;
      }
      txt.innerHTML = tit.innerHTML = "";
      setTimeout("dText()", 32);
      }
      }
      }
      this.anim = function () {
      with(this){
      vz = speed*(vz+(x1-sx)*delay);
      x1 -= vz;
      sx = (n==0)?0:O[n-1].x0+O[n-1].dim;
      zo -= (zo-dim)*speed;
      l = (x1*si)+6*(n+1);
      w = zo*si;
      is.style.left = Math.round(l)+'px';
      is.style.top = Math.round((H-w*rImg)*.5)+'px';
      is.style.width = Math.round(w)+'px';
      is.style.height = Math.round(w*rImg)+'px';
      if(sel == n){
      if(sel<nI*.5) {
      tit.style.left = txt.style.left = Math.round(l+w+6)+'px';
      } else {
      tit.style.left = txt.style.left = Math.round(l-(nx*.25)-6)+'px';
      }
      txt.style.top = Math.round(-(w*rImg)*.25)+'px';
      tit.style.top = Math.round((w*rImg)*.33)+'px';
      }
      }
      }
      }
      
      function run(){
      for(j in O)O[j].anim();
      setTimeout("run()", 16);
      }
      
      function doResize(){
      tit.style.width = Math.round(nx*.25)+'px';
      txt.style.width = Math.round(nx*.25)+'px';
      tit.style.fontSize = (nx/30)+'px';
      txt.style.fontSize = (nx/70)+'px';
      with(box.style){
      width = Math.round(W)+'px';
      height = Math.round(H)+'px';
      left = Math.round(nx/2-W/2)+'px';
      top = Math.round(ny/2-H/2)+'px';
      }
      }
      
      function resize(){
      nx = scr.offsetWidth;
      ny = scr.offsetHeight;
      W = nx*90/100;
      si = (W-((nI+1)*6))/((ZOOM*100)+((nI-1)*100));
      H = (100*si*rImg)+14;
      doResize();
      }
      onresize = resize;
      
      onload = new function(){
      scr = document.getElementById("screen");
      box = document.getElementById("box");
      tit = document.getElementById("tit");
      txt = document.getElementById("txt");
      img = box.getElementsByTagName("img");
      Lnk = document.getElementById("lnk").getElementsByTagName("a");
      nI = img.length;
      ZOOM = nI;
      rImg = img[0].height/img[0].width;
      resize();
      s = ZOOM * 100;
      x = 0;
      tit.innerHTML = img[0].title;
      txt.innerHTML = img[0].alt;
      for(i=0; i<nI; i++) {
      var t = img*.alt;
      if(Lnk*.href!="") t+='<br><a href="'+Lnk*.href+'">'+Lnk*.innerHTML+'</a>';
      O* = new CObj(i, s, x, t, img*.title);
      img*.alt = "";
      img*.title = "";
      img*.onmousedown = new Function("return false;");
      img*.onmouseover = new Function('O['+i+'].over();');
      if(Lnk*.href!=""){
      /* ==== hyperlink ==== */
      img*.onclick = new Function('window.open("'+Lnk*.href+'","_blank");');
      }
      x += s;
      s = 100;
      }
      box.style.visibility = "visible";
      run();
      }
      
      
      postato in Coding
      G
      giangi56