rejetto forum

About the file type..

Guest · 3 · 3155

0 Members and 1 Guest are viewing this topic.

ivanfong

  • Guest
i wrote a javascript... for the preview of pic and movie

Code: [Select]
<SCRIPT Language=Javascript>
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all

function enlarge(which,e,ty,filename){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
if (ty=="~img37"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'<b onClick=closepreview(event) style=font-family:tahoma;font-size:8pt><font color=red>[X]</font></b></td></tr></table></div><img src="'+which+'" height=480 width=640>'
crossobj.style.visibility="visible"
}else if (ty=="~img45"||ty=="~img35"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'[X]</font></b></td></tr></table></div><object data="'+which+'" height=260 width=320 type="video/quicktime"></object>'
crossobj.style.visibility="visible"
}else{
crossobj.innerHTML='<div align=center id=drag><table bgcolor=white><tr><td align=center><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:12pt><font color=red>這不是圖片或影片!不可預覽![X]</font></b></td></tr></table></div>'
crossobj.style.visibility="visible"
}
return false
}


function closepreview(e){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
crossobj.innerHTML=''
crossobj.style.visibility="hidden"
return false
}

</script>
but i discover that the ~img_file code will change everytime when u start the HFS..how come?

and it cant auto load the HTML Template.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
I'm not sure of what you are asking.
The index of file icons is not fixed, so you should not rely on it.
If you want to know the filetype, you'd better check the filename instead.


Offline PikachuEXE

  • Occasional poster
  • *
    • Posts: 35
    • View Profile
    • http://pikachuexe.hopto.org/
Quote from: "ivanfong"
i wrote a javascript... for the preview of pic and movie

Code: [Select]
<SCRIPT Language=Javascript>
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all

function enlarge(which,e,ty,filename){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
if (ty=="~img37"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'<b onClick=closepreview(event) style=font-family:tahoma;font-size:8pt><font color=red>[X]</font></b></td></tr></table></div><img src="'+which+'" height=480 width=640>'
crossobj.style.visibility="visible"
}else if (ty=="~img45"||ty=="~img35"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'[X]</font></b></td></tr></table></div><object data="'+which+'" height=260 width=320 type="video/quicktime"></object>'
crossobj.style.visibility="visible"
}else{
crossobj.innerHTML='<div align=center id=drag><table bgcolor=white><tr><td align=center><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:12pt><font color=red>這不是圖片或影片!不可預覽![X]</font></b></td></tr></table></div>'
crossobj.style.visibility="visible"
}
return false
}


function closepreview(e){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
crossobj.innerHTML=''
crossobj.style.visibility="hidden"
return false
}

</script>
but i discover that the ~img_file code will change everytime when u start the HFS..how come?

and it cant auto load the HTML Template.
preview...??
it may cause a lot of source(for CPU)
that's a good idea but not suitable for slow computer...


PS:i see that ther are some chinese word...
i know the meaning coz i am a chinese...
but ... this is a english forum
change all language into english, ok?? :D
nothing.......orz