please verivy this code

Z

ziemon

Can u please verify if this code works on a MAC and or PC?

test.htm?hello.jpg ( should see save thing on PC and MAC)
test.htm?hello.png ( should see save thing on PC and MAC)
test.htm?hello.ppt ( should see save thing on PC but not on MAC)
test.htm?hello.pdf ( shouldn't see save thing on PC and MAC)
test.htm?hello.doc ( shouldn't see save thing on PC and MAC)


tnx


/// TEST.HTM ///
document.write('<table>')
var save = (location.search ? location.search.substring(1) : '');
var notmac = navigator.userAgent.indexOf("Mac")==-1
if (notmac && save.indexOf(".ppt") >= 0 || save.indexOf(".png") >= 0 ||
save.indexOf(".jpg") >= 0)
{
// PC
document.write('<tr valign="middle" align="left">')
document.write('<td colspan="2"><br></td>')
document.write('</tr>')
document.write('<tr valign="middle" align="left">')
document.write('<td height="32"><img src="../../images/dot.gif" width="32"
height="1" alt="" border="0"><a href="../../images/ap/' + save + '"
target="_new" class="nav"><img src="../../images/save.gif" width="32"
height="32" alt="" border="0"></a></td><td>&nbsp;&nbsp;<a
href="../../images/ap/' + save + '" target="_new" class="nav">Klik
rechtermuisknop om te bewaren</a></td>')
document.write('</tr>')
}
else if (save.indexOf(".png") >= 0 || save.indexOf(".jpg") >= 0)
{
// MAC
document.write('<tr valign="middle" align="left">')
document.write('<td colspan="2"><br></td>')
document.write('</tr>')
document.write('<tr valign="middle" align="left">')
document.write('<td height="32"><img src="../../images/dot.gif" width="32"
height="1" alt="" border="0"><a href="../../images/ap/' + save + '"
target="_new" class="nav"><img src="../../images/save.gif" width="32"
height="32" alt="" border="0"></a></td><td>&nbsp;&nbsp;<a
href="../../images/ap/' + save + '" target="_new" class="nav">"CTRL" +
rechtermuisknop om te bewaren</a></td>')
document.write('</tr>')
}
else {}
document.write('</table>')
 
N

nice.guy.nige

While the city slept said:
var notmac = navigator.userAgent.indexOf("Mac")==-1
if (notmac && save.indexOf(".ppt") >= 0 || save.indexOf(".png") >= 0

What happens if I am using a *nix machine? Or any of the other many and
varied non-windows/non-mac OS's out there?

Cheers,
Nige

--
Nigel Moss.

Email address is not valid. (e-mail address removed). Take the dog out!
http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
"How strange the change from major to minor..."
 
Z

ziemon

IF the code works and if it's not mac u should see the picture ( which is
not there ) and some txt at "file.ppt" "file.png" and "file.jpg"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,219
Latest member
Geraldine7

Latest Threads

Top