Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13

Discussione: stampare risultato

  1. #1

    stampare risultato

    Salve a tutti/e,

    premetto che sono completamente digiuno di JS ma vorrei modificare uno script trovato che ingrandisce le thumbnail nella stessa pagina. Funziona perfettamente caricando l'immagine in un div, ma nell'html non visualizza il classico tag [img]....[/img]. suppongo che dipenda dalla funzione window.onload=function(). Ne esiste una che combinata a questa crei il tag <img src"">?

    Grazie
    En la habana hay una pila 'e locos!

  2. #2

    Re: stampare risultato

    Originariamente inviato da scudobravo
    Salve a tutti/e,

    premetto che sono completamente digiuno di JS ma vorrei modificare uno script trovato che ingrandisce le thumbnail nella stessa pagina. Funziona perfettamente caricando l'immagine in un div, ma nell'html non visualizza il classico tag [img]....[/img]. suppongo che dipenda dalla funzione window.onload=function(). Ne esiste una che combinata a questa crei il tag <img src"">?

    Grazie
    puo essere che viene caricata come immagine di sfondo di un div, per questo non vedi il tag img,
    comunque non ho capito bene la domanda...

  3. #3
    Bah non saprei, allego il js


    var thumbnailviewer2={
    enableTitle: true, //Should "title" attribute of link be used as description?
    enableTransition: true, //Enable fading transition in IE?
    hideimgmouseout: false, //Hide enlarged image when mouse moves out of anchor link? (if enlarged image is hyperlinked, always set to false!)

    /////////////No need to edit beyond here/////////////////////////

    iefilterstring: 'progidXImageTransform.Microsoft.GradientWipe(GradientSiz e=1.0 Duration=0.7)', //IE specific multimedia filter string
    iefiltercapable: document.compatMode && window.createPopup? true : false, //Detect browser support for IE filters
    preloadedimages:[], //array to preload enlarged images (ones set to display "onmouseover"
    targetlinks:[], //array to hold participating links (those with rel="enlargeimage:initType")
    alreadyrunflag: false, //flag to indicate whether init() function has been run already come window.onload

    loadimage:function(linkobj){
    var imagepath=linkobj.getAttribute("href") //Get URL to enlarged image
    var showcontainer=document.getElementById(linkobj.getA ttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
    var dest=linkobj.getAttribute("rev").split("::")[1] //Get URL enlarged image should be linked to, if any
    var description=(thumbnailviewer2.enableTitle && linkobj.getAttribute("title"))? linkobj.getAttribute("title") : "" //Get title attr
    var imageHTML='[img]'+imagepath+'[/img]' //Construct HTML for enlarged image
    if (typeof dest!="undefined") //Hyperlink the enlarged image?
    imageHTML=''+imageHTML+''
    if (description!="") //Use title attr of the link as description?
    imageHTML+='
    '+description
    if (this.iefiltercapable){ //Is this an IE browser that supports filters?
    showcontainer.style.filter=this.iefilterstring
    showcontainer.filters[0].Apply()
    }
    showcontainer.innerHTML=imageHTML
    this.featureImage=showcontainer.getElementsByTagNa me("img")[0] //Reference enlarged image itself
    this.featureImage.onload=function(){ //When enlarged image has completely loaded
    if (thumbnailviewer2.iefiltercapable) //Is this an IE browser that supports filters?
    showcontainer.filters[0].Play()
    }
    this.featureImage.onerror=function(){ //If an error has occurred while loading the image to show
    if (thumbnailviewer2.iefiltercapable) //Is this an IE browser that supports filters?
    showcontainer.filters[0].Stop()
    }
    },

    hideimage:function(linkobj){
    var showcontainer=document.getElementById(linkobj.getA ttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
    showcontainer.innerHTML=""
    },


    cleanup:function(){ //Clean up routine on page unload
    if (this.featureImage){this.featureImage.onload=null; this.featureImage.onerror=null; this.featureImage=null}
    this.showcontainer=null
    for (var i=0; i<this.targetlinks.length; i++){
    this.targetlinks[i].onclick=null
    this.targetlinks[i].onmouseover=null
    this.targetlinks[i].onmouseout=null
    }
    },

    addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
    var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
    if (target.addEventListener)
    target.addEventListener(tasktype, functionref, false)
    else if (target.attachEvent)
    target.attachEvent(tasktype, functionref)
    },

    init:function(){ //Initialize thumbnail viewer script
    this.iefiltercapable=(this.iefiltercapable && this.enableTransition) //True or false: IE filters supported and is enabled by user
    var pagelinks=document.getElementsByTagName("a")
    for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
    if (pagelinks[i].getAttribute("rel") && /enlargeimage:/i.test(pagelinks[i].getAttribute("rel"))){ //Begin if statement: Test for rel="enlargeimage"
    var initType=pagelinks[i].getAttribute("rel").split("::")[1] //Get display type of enlarged image ("click" or "mouseover")
    if (initType=="mouseover"){ //If type is "mouseover", preload the enlarged image for quicker display
    this.preloadedimages[this.preloadedimages.length]=new Image()
    this.preloadedimages[this.preloadedimages.length-1].src=pagelinks[i].href
    pagelinks[i]["onclick"]=function(){ //Cancel default click action
    return false
    }
    }
    pagelinks[i]["on"+initType]=function(){ //Load enlarged image based on the specified display type (event)
    thumbnailviewer2.loadimage(this) //Load image
    return false
    }
    if (this.hideimgmouseout)
    pagelinks[i]["onmouseout"]=function(){
    thumbnailviewer2.hideimage(this)
    }
    this.targetlinks[this.targetlinks.length]=pagelinks[i] //store reference to target link
    } //end if statement
    } //END FOR LOOP


    } //END init() function

    }


    if (document.addEventListener) //Take advantage of "DOMContentLoaded" event in select Mozilla/ Opera browsers for faster init
    thumbnailviewer2.addEvent(document, function(){thumbnailviewer2.alreadyrunflag=1; thumbnailviewer2.init()}, "DOMContentLoaded") //Initialize script on page load
    else if (document.all && document.getElementsByTagName("a").length>0){ //Take advantage of "defer" attr inside SCRIPT tag in IE for instant init
    thumbnailviewer2.alreadyrunflag=1
    thumbnailviewer2.init()
    }
    thumbnailviewer2.addEvent(window, function(){if (!thumbnailviewer2.alreadyrunflag) thumbnailviewer2.init()}, "load") //Default init method: window.onload
    thumbnailviewer2.addEvent(window, function(){thumbnailviewer2.cleanup()}, "unload")
    En la habana hay una pila 'e locos!

  4. #4
    lo script che hai postato fa una specie di preload delle immagini e genera i tag img.
    il problema è che non ho ben capito il tuo scopo.

  5. #5
    Beh, io vorrei poter visualizzare il tag img nell'html, cosa che questo script non fa. È possibile? Sapresti come fare?
    En la habana hay una pila 'e locos!

  6. #6
    tutto è possibile per me
    ma prima di gettarsi a testa china nella stilatura di fiumi di codice, vorrei capire perchè

    allora, tu da quel che ho capito hai una pagina pippo.htm che contiene quel codice che gestisce le thumbnails, giusto.
    tu da quel che ho capito vorresti che facendo view-sourceippo.htm
    si vedesse l'immagine.

    perchè?
    siamo realisti, chi vuoi che vada a vedere il sorgente della tua pagina?

    se è solo per te allora il discorso cambia, esiste firefox e la sua estensione firebug che ti permette di vedere il dom immagini comprese in qualsiasi momento,
    esiste anche la developer toolbar per IE.

    se invece il tuo problema è un altro, ovvero
    con gli script disabilitati l'immagine non si vede, allora si deve agire in un altra maniera, ma da quel che ho capito dando un occhiata veloce allo script che hai postato questo problema non dovrebbe esserci.
    (mi sembra infatti che l'immagine deve essere presente come thumbnails nel sorgente e che debba linkare a quella reale).

  7. #7
    Ti espongo il vero problema: in realtà la pagina é in php e pesca le immagini da un database. Ma per poter visualizzare il commento e l'alt di ogni immagine penso che dovrei riuscire a stamparla nel codice. Così come é adesso si vede l'immagine ma perdo le altre informazioni!
    En la habana hay una pila 'e locos!

  8. #8
    ah, allora nel javascript che hai postato prova a sostituire il seguente codice
    codice:
    //Get title attr
    var imageHTML='[img]'+imagepath+'[/img]' //Construct HTML for enlarged image
    con
    codice:
    var imageHTML=
    '[img]'+imagepath+'[/img]'

  9. #9
    Ti dirò avevo già provato, inventandomi il codice , ma non funziona. Mi sa che ci vuole una funzioncina che lo stampi.....
    En la habana hay una pila 'e locos!

  10. #10
    Originariamente inviato da scudobravo
    Ti dirò avevo già provato, inventandomi il codice , ma non funziona. Mi sa che ci vuole una funzioncina che lo stampi.....
    si, ma se la modifica che ti ho suggerito non va, significa che nella pagina dove richiami lo script non hai settato correttamente l'immagine con i tag alt e title...


    ps. guardando meglio il codice mi sembra che peschi il link direttamente dal tag A, prova a mettere alt e title lì, io comunque avrei gestito in maniera diversa.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.