I have Javascript that I use to confirm the deletion of a file. Because it's interlaced with my ColdFusion app, I dynamically generate the onclick command that calls my script.
Here's my problem... When the onclick is dynamically generated from CF, It renders the HTML/onClick code as the following on some files with a "'" apostophy character in it. This is because my app happened to find a filename with a "'" in it. Since I can't control the filenames that the users upload, How can I get the following example to work without any nagging script debuggin errors???
Here's my javascript:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function deleteFile(strName,strType){
if (confirm("Are you sure you want to delete this " + unescape(strType) +"?\n" + unescape(strName))){
window.location="index.cfm?ACTION=DELETE&SUBDIR=&FILENAME=" +escape(strName)+ "&TYPE=" +escape(strType);
}
}
//-->
</SCRIPT>
Here an example of it not working (because of the "'" in one of the filenames:
<A href="#" onClick="deleteFile('Customer_Doc's','Dir')"><img src="delete.jpg" width="40" height="15" border="0"></A>
THANKS IN ADVANCE FOR ANY HELP!!
Here's my problem... When the onclick is dynamically generated from CF, It renders the HTML/onClick code as the following on some files with a "'" apostophy character in it. This is because my app happened to find a filename with a "'" in it. Since I can't control the filenames that the users upload, How can I get the following example to work without any nagging script debuggin errors???
Here's my javascript:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function deleteFile(strName,strType){
if (confirm("Are you sure you want to delete this " + unescape(strType) +"?\n" + unescape(strName))){
window.location="index.cfm?ACTION=DELETE&SUBDIR=&FILENAME=" +escape(strName)+ "&TYPE=" +escape(strType);
}
}
//-->
</SCRIPT>
Here an example of it not working (because of the "'" in one of the filenames:
<A href="#" onClick="deleteFile('Customer_Doc's','Dir')"><img src="delete.jpg" width="40" height="15" border="0"></A>
THANKS IN ADVANCE FOR ANY HELP!!