[Javascript] Re: Using Javascript Indexof (Alan Easton)
Alberto .·. Vallini
vallinis at yahoo.com
Tue Nov 11 03:25:26 CST 2003
This is not very clear, you should post also the
concerned HTML (not all the page! Just the form tag
and the two concerned fields): it is not said HOW you
call in isReady() which is surely the problem: you
have probably set up an infinite loop of functions
calling each others upon the event, without realizing
that loop between functions; but I can't truly guess
without the HTML you see.
Also, close the striong quote in the exptression
alert('Your Image Filename contains INVALID
characters);
See, the closing apex is missing: correct is:
alert('Your Image Filename contains INVALID
characters');/*added the last ' */
ciao
Alberto
http://www.unitedscripters.com/
>
> Hi Everyone,
>
> I am using the following piece of code to ensure a
> image filename does not
> include the "&" character......
>
> <script language="javascript">
> function makefile() {
> document.form_save.myfile.value =
> document.form_save.FILE1.value;
> }
>
> function isReady(form) {
> mypic = document.form_save.myfile.value;
> if(mypic.indexOf('&') == -1){
> alert('Your Image Filename contains INVALID
> characters);
> form.FILE1.focus();
> return false;
> }
> }
> </script>
>
> On the actual FILE1 form field, I run an OnChange
> function that copies what
> file has been selected(see above makefile()
> function) into another form
> field called "myfile", it is this field that is then
> queried using Indexof.
>
> Unfortunately, the alert box pops up all the time,
> no matter what characters
> are in the filename.
>
> Has any one any ideas why it would do this or am I
> not using Indexof
> correctly.
>
> Many Thanks for any help,
>
> Alan...
>
> ------------------------------
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> End of Javascript Digest, Vol 9, Issue 8
> ****************************************
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
More information about the Javascript
mailing list