Click to See Complete Forum and Search --> : Cannot open filename that contain a # sign


davidxz
09-03-2003, 06:26 PM
My ASP file ViewImage.asp) looks like this:

<html><body>

<script language="javascript">
function viewImg(d){
var fname = d[d.selectedIndex].value;
var msg=window.open('SampleImages/' + fname,'msg','width=350,height=350,scrollbars,resizable')
}
</script>

<form>
<select name="myImages">
<option value="Sample 1.jpg">Sample 1</option>
<option value="Sample 2.jpg">Sample 2</option>
<option value="Room # 1 Lab.jpg">Room # 1 Lab</option>
<option value="Room_#_1_Lab.jpg">Room_#_1_Lab</option>
</select>

<br>
<input type="button" value="View" class="buttons" onclick="JavaScript: viewImg(this.form.myImages)">
</form>

</body></html>


The dropdown list was populated from database with image file names.

In this example, I can view images "Sample 1.jpg" and Sample 2.jpg", but I cannot open "Room # 1 Lab.jpg" or "Room_#_1_Lab.jpg" because there is # sign in the file name.

In this project the files are from the database and I am not authorized to rename images files, so I have to deal with this type of file name. How can I do it? Please help!
Thanks,
David

txmail
09-06-2003, 11:56 PM
I would try inserting the character code for the pound sign and see if that works.