rejetto forum

Javascript and Img Icons in HFS

0 Members and 1 Guest are viewing this topic.

Offline Flynsarmy

  • Occasional poster
  • *
    • Posts: 92
  • DENIED!
    • View Profile
    • Flynsarmy
I've been trying to use Javascript to call a function from within the [file] tag like so:

Code: [Select]
[file]
addFile("%item-name%", "%item-url%", "%item-size%", "%item-modified%", "%item-dl-count%", "%comment%", "%new%");


inside the addFile function, I have the line
Code: [Select]
document.write('<a href="'+url+'"><img name="newimg"'+fileNum+'" src="/\~img_file" /><br>'+name+'</a><br>');
Basically, this will show the image with a link. The problem is, the page only displays a little white box which i'm assuming is the
default HFS icon. I believe the problem is that if you don't call ~img_file within the [file] tag, HFS will return the default image.
addFile() is not located within the [file] section, its in the pages <head> tag.

Does anyone have any ideas on how to get images working if called in a javascript function? Maybe a new HFS function would
help, something like: ~img_file?<url> which would make HFS retrieve the icon for the file in the URL (a file within the
filesystem). You could call it like
Code: [Select]
<img src=~img_file?%item-url%>
Any help would be appreciated.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile

Offline Flynsarmy

  • Occasional poster
  • *
    • Posts: 92
  • DENIED!
    • View Profile
    • Flynsarmy
Would it be possible to get an example of how I could do that? Earlier today I managed to create the icons
but couldn't figure out how to set a second image to be the same as the icon image. I've attached the work
I did today. It's a really messy way of doing it, and there is no doubt a better way.

[attachment deleted by admin]


unlogged rejetto

  • Guest
something like
Code: [Select]
[file]
addFile("%item-name%", "%item-url%", "%item-size%", "%item-modified%", "%item-dl-count%", "%comment%", "%new%", "~img_file");

it's the same...

but couldn't figure out how to set a second image to be the same as the icon image.

second image?  ???