Ask a Question related to ASP Database, Design and Development.
-
A. J. #1
problem when displaying image
Hi,
I made this code the retrive some info from my access DB, then choose
another image from Products folder(images were not saved in DB)
Everhthing is O.K., but when I changed the Image name from the drop down
box the image became empty, and when I checked the image properties I
found it looking in the same folder not in the Products folder.
the question is how can I let the code display the image correctly ??
here is my code:
======
<!--#include file="database.asp"-->
<script language="javascript">
<!--
function showimage()
{
if (!document.images)
return
document.images.pictures.src=document.MyForm.Image .options[document.MyFo
rm.Image.selectedIndex].value
}
//-->
</script>
<%
ID = Request.Querystring("ID")
MySQL = "SELECT Product.ID, Product.Product_Name, Product.Product_Image
WHERE Product.ID=" & ID & ""
Set rs=Conn.Execute(MySQL)
if rs.EOF Then
respons.write("The product is not found.")
Else
%>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSy stemObject")
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder(Server.MapPath("/images/products/"))
%>
<input type="text" name="Product_Name" size="43"
value="<%=rs("Product_Name")%>"></font>
<p>
<img border="0" src="../images/products/<%=rs("Product_Image")%>"
Name="pictures">
<br>
<select size="1" Name="Image" onChange="showimage()">
<option selected>-- ÇÎÊÑ ÕæÑÉ</option>
<%
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<option value="<%=thing.Name%>"><%=thing.Name%></option>
<% next %>
</select> </p>
<%
rs.close
end if
%>
======
BTY I saved this code in another folder not in the Products folder.
Thanks in advance
A. J.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
A. J. Guest
-
Displaying part of an image
I'm making a board game in Flex. Both to save bandwidth and for convenience in the code, I want to store the bitmaps for all the tiles in a single... -
Displaying an image
I know there must be a simple answer to this question but researching dozens of php books and the web has not revealed an answer... How do I... -
Displaying image in browser but not source
Hi, I have an 'invisible' image I would like to display in a php script I have just written. It does it's job fine, the only problem is that in IE... -
Displaying Larger Image On Rollover
Hi Steve, You could use multiple disjointed rollovers. Since rollover slices don't have to be on top of each other or even adjacent, and one... -
Displaying Image on web page question
My .php app displays an image on the web page, I notice that different ..jpg images display "funny" - apparently they all have slightly different... -
A. J. #2
Re: problem when displaying image
Guys is that true that you don't know anything about it ??? :(
A. J.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
A. J. Guest
-
Bob Barrows #3
Re: problem when displaying image
A. J. wrote:
The problem is that you've asked a client-side jscript coding question on an> Guys is that true that you don't know anything about it ??? :(
>
> A. J.
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
asp (server-side code) newsgroup. You'll get better response in the future
by asking your questions on the appropriate group, such as
m.p.scripting.jscript.
Having said that, your problem is that you need to supply the entire path in
this statement:
document.images.pictures.src=document.MyForm.Image .options[document.MyFo
rm.Image.selectedIndex].value
in much the same way that you supplied it in this statement:
<img border="0" src="../images/products/<%=rs("Product_Image")%>"
Name="pictures">
When you set the src property to something new, you are replacing EVERYTHING
in the src property, not just the part of the string that follows the path.
Try this:
var newsrc="../images/products/" +
document.MyForm.Image.options[document.MyFo
rm.Image.selectedIndex].value;
document.images.pictures.src=newsrc;
Bob Barrows
Bob Barrows Guest



Reply With Quote

