mask backslashes

04/06/2008 - 22:03 von michael mazanek | Report spam
Hi all,
i have button with the following Onclick event:

<input name="but_add2db" type="button"
OnClick="window.open('addtestrun.php?file=<%=(rsTask.Fields.Item("input_data_file").Value)%>,'newWindow')">

The problem is that the Item("input_data_file").value is a string with
backslahes in it. this wont work. i tried out that if i mask a backslash
with a double backslash it will work. (i inserted a string instead of
the item.value variable, like: addtestrun.php?file=\\bla\\x.bmp )

so my question: how can i mask all backslashes in the item.value? or how
can i change them from "\" to "\\"?

i'm totally new to ASP so please be patient with me. i dont even know if
this is an ASP or javascript question.

thanks for every advice.
michael
 

Lesen sie die antworten

#1 Stefan Falz [MVP]
04/06/2008 - 23:54 | Warnen spam
Hi Michael,

"michael mazanek" schrieb:

<input name="but_add2db" type="button"
OnClick="window.open('addtestrun.php?file=<%=(rsTask.Fields.Item("input_data_file").Value)%>,'newWindow')">

The problem is that the Item("input_data_file").value is a string with
backslahes in it. this wont work.



Use Server.UrlEncode( rsTask.Fields.Item("input_data_file").Value ) to encode the special
characters.

or how can i change them from "\" to "\\"?



<Variable> = Replace( <Variable>, "\", "\\" )

BTW: This is a german newsgroup.

Tschau, Stefan
Microsoft MVP - Visual Developer ASP/ASP.NET
http://www.asp-solutions.de/ - Consulting, Development
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community

Ähnliche fragen