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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preload images retrieved from database?

Status
Not open for further replies.

booboo0912

Programmer
Jul 31, 2002
75
0
0
US
I don't really have my images in the database but just the image names (pic1.jpg). Depending on which id is passed to my page, the SQL statement selects all the image names for that id. I put an onload event in my body tag to call the following function, but the javascript seems to fire before the connection to the database. At least the error I got said 'rs2 does not exist'...

function getImages() {
if(document.images) {
x=0;
if(!rs2.EOF) {
image[x] = new Image();
image[x] = rs2("pictureName");
rs2.MoveNext;
}
}

My function most likely needs some work too so any help with that is appreciated as well! How would I go about preloading images (image names) called from a database?
Thank you!
 
Hi Dan!
More than likely I am confusing server-side and client-side JS, but I'm just not sure how to go about doing this. [ponder] My database is on the server.
Thanks for your help!
 
Server-side code...I'm pulling data from the database (using ASP) then building my image source tag based on data in the database to display the images. I'm not making any updates to the database (yet), just pulling the information.

I hope I'm answering your question(s) correctly...I've been up all night so I'm a bit woozy right now. Please let me know if I'm not being clear enough.

And good catch...I started out using VBscript and converted everything to JS since I've used that more. :)

Thanks!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top