PDA

View Full Version : please help me


nicolangelo
04-27-2003, 09:55 AM
I use the following form to search for images or docs
using a two frame page it works fine but if an incorrect
file name is entered I get the 404 default page
which isn't nice at all. How can I get the browser
to show an "error page" or "alert window"?
thank you.
Nico




<SCRIPT LANGUAGE="JAVASCRIPT"><!--
var new_url;
function checkform(filename)
{
if (code=='') {
alert("\type a correct file name");
}

else {
new_url='folder/'+filename+'.jpg';
parent.mainFrame.window.location = new_url;
}
}
//--> </script>




<input type="text" maxlength="15" name="filename" size="10" on submit="checkform(filename.value)">
<input type="button" value="Trova" onClick="checkform(filename.value)" name="button">

scroots
04-27-2003, 10:16 AM
there mite be away but you would havr to alter your method.

scroots

nicolangelo
04-29-2003, 05:05 PM
thank you scroots.

could you please tell me how?
if you can.

I'm not really into Java and I'd
appreciate some help.

by the way, the code as it was posted wouldn't work
in the attempt to make it understandable and suitable to all
I made a small mistake.


change the line if (code=='') {
whith if (filename=='') {
just in case someone "like me" wants to use it.


cheers!
nico

scroots
04-29-2003, 08:43 PM
it would involve in passing the image location to a page in the lower frame and have javascript write it out as a picture. Then you would use the onerror event (i'm not familair with it but i know it exists) to detect if the image is fine. Then a redirect or message could be shown.

scroots