rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: ledufe on December 05, 2006, 05:36:54 AM

Title: maybe this javascript could be of some use
Post by: ledufe on December 05, 2006, 05:36:54 AM
well i found some information about javascript acessing files on the server(A.K.A. external file), and guess what??? i found that is possible....

here is the code to use and change and test ....

i think that this may be of some use for those who wants a shoutbox, a guest book or even some news being displayed on the hfs.

tested and only works on the internet explorer, at least until somebody help me here...

or it may be useless to all, but for sure it will be useless when hfs support any server side code.... like asp, php, cfm, ruby, cgi....
hehhe

and about the code...

here i got 2 files
Read_External_File.html
news.txt

the content of the files is this

the html
Code: [Select]
<html>
  <head>
    <title>
ledufe- test of acessing a external-TXT file with javascript - Only On IE 5.5 or upper versions
    </title>
  </head>
<body>

<object id="ticker" classid="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
        <param name="DataURL" value="news.txt">
        <param name="UseHeader" value="TRUE">
        <param name="FieldDelim" value="#">
</object>

<script type="text/javascript">
function tdcticker(){
tickerSet.MoveNext();
if (tickerSet.EOF) //if end of data's file
tickerSet.MoveFirst()
setTimeout("tdcticker()",5000);
}
function init(){
tickerSet=ticker.recordset
tickerSet.moveFirst()
setTimeout("tdcticker()",5000)
}
</script>

<h3>HFS-News Ticker</h3>
<a href="" datasrc="#ticker" datafld="messageURL" target="_blank"
style="width:230px; border:1px solid black; background-color:#d0d0d0;padding:5px">
<span id="tickerDiv" datasrc="#ticker" datafld="message"></span>
</a>
<script type="text/javascript">
if (document.all)
ticker.ondatasetcomplete=init
</script>

</body>
</html>

and here the .txt file:

Code: [Select]
message#messageURL
HTTP File Server#http://www.rejetto.com/hfs/
HFS Wiki#http://www.rejetto.com/wiki/
LeDuFe HFS#http://ledufe.no-ip.info:2222
IE-Intercambio#http://www.ie-intercambio.com.br
IE-Ipanema HFS#http://ie-ipanema.no-ip.info:2222

it may be of some use...

and here the live preview http://ledufe.no-ip.info:2222/HFS-templates/ledufe/externalfile-shoutbox/Read_External_File.html (http://ledufe.no-ip.info:2222/HFS-templates/ledufe/externalfile-shoutbox/Read_External_File.html) , as i said before, only works on the internet explorer
but if somebody got any free time, try to use his code with the upload function, you may be surprised with the results... or expect some news here in this post, soon as i got some time again....
sorry for this people, but i am a kind of busy these days, the end of the year is making my company to work much more than in the other seasons.....

sorry about the url error... ::)
Title: Re: maybe this javascript could be of some use
Post by: rejetto on December 05, 2006, 05:45:35 AM
...localhost...
correct the url ;)
Title: Re: maybe this javascript could be of some use
Post by: TSG on December 05, 2006, 05:51:44 AM
Very cool, strange the box doesn't work in Firefox. Is it because the DIV, or whatever it is, hasn't got a width set?
Title: Re: maybe this javascript could be of some use
Post by: Fysack on December 05, 2006, 12:18:54 PM
Nice. I like it a lot..