Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

quote a string 1

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

I have bad time quoying the following:

<LI><a HREF="Javascript:void(0)" onclick="Run('c:\program files\Internet Explorer\IEXPLORE.EXE '+String.fromCharCode(34)+'d:/temp/POD/JobTickets/filename'+String.fromCharCode(34));">filename</A></li>

The problem is quoting the 'c:\program files\Internet Explorer\IEXPLORE.EXE ' string (the space at the end is on purpose).
Appreciate ideas.
Thanks

Long live king Moshiach !
 
Every time you use backslash in literal string, you need to double it up. So, on the face of it, it should be looked more like this.
[tt]
<LI><a HREF="Javascript:void(0)" onclick="Run('c:[red]\[/red]\program files[red]\[/red]\Internet Explorer[red]\[/red]\IEXPLORE.EXE '+String.fromCharCode(34)+'d:/temp/POD/JobTickets/filename'+String.fromCharCode(34));">filename</A></li>
[/tt]
 
Thanks

Another problem I have though is the "filename".
All works well unless it has spaces inside.
I would have expected that this would be dealt with by +String.fromCharCode(34)+ , but it does not happen.
Any idea why ?

Long live king Moshiach !
 
I can only guess your Run(). Actually [1] you need to wrap the exe part with quotes as well.
[tt]
<LI><a HREF="Javascript:void(0)" onclick="Run('\x22c:\\program files\\Internet Explorer\\IEXPLORE.EXE\x22 '+String.fromCharCode(34)+'d:/temp/POD/JobTickets/filename'+String.fromCharCode(34));">filename</A></li>
[/tt]
I use here embedded \x22 which is another way to say String.fromCharCode(34) with less keystrokes. The above mixed backward/forward slash convention, and \x22 and String.fromCharCode(34). So you have all the alternatives displayed. You sure should write it in consistent convention for not taxing the eyes too much and for easier maintenance.
 
Thanks.

The following works fine,except when the "file name" has spaces ...

onclick="Run('\x22c:\\Program Files\\Internet Explorer\\Iexplore.exe\x22 '+'\x22d:/temp/POD/JobTickets/file name\x22');"

Long live king Moshiach !
 
You make that observation, I am not convinced. I make a test page. I cannot reproduce the problem. I don't think the problem is from the form of paths and variable passing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top