• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Replace function

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am writing a replace function in Javascript to remove the spaces in a filename which is used for file upload. Somehow my replace function is not getting executed.

Here is the code:

<SCRIPT language = JavaScript>

function test ()
{
var str1 = document.formname.filename.value
str1 = str1.replace(" ", "%20");
}
</script>
and this function is called on the submit button.

Can you please let me know where I am going wrong.

Thanks
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you want to do this:

but you might be better off by doing

Eric
[ May 25, 2005: Message edited by: Eric Pascarello ]
reply
    Bookmark Topic Watch Topic
  • New Topic