Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 21st, 2004, 08:44 AM
Authorized User
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ctranjith
Default Loading Image to Image Control using JavaScript

 How can I Load an Image to an Image Control using JavaScript

Expecting reply

C T Ranjith

Old May 28th, 2013, 05:43 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi

If the images elements are already in your markup, and they have the src attribute defined, the image files will be downloaded when the page starts loading.

You should either create the image elements programmatically or leave the src attribute empty on your markup, and then assign it when the user clicks next.

You could remove the src attribute of your images, and store it using the $.data function, then in your click event, restore the image src to its original value, for example:

$(function () {
// put a "defaultImage" on all images of gallery
// and store the original src attribute
$('#gallery img').each(function () {
$(this).data('originalSrc', $(this).src).attr('src', 'defaultImage.jpg');

$('#gallery img').each(function () {
// restore the original src attribute:
$(this).attr('src', $(this).data('originalSrc'));

It is not important what you get But important is  how you got it

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get image size without loading? tal Javascript How-To 3 June 30th, 2007 07:05 AM
image loading abaso.jadhav01 ASP.NET 2.0 Basics 0 October 28th, 2006 01:24 AM
Loading Image through XSL anaik100 XSLT 0 February 15th, 2006 10:23 PM
Problems in Loading Image ctranjith General .NET 0 December 18th, 2004 06:01 AM
Trouble with loading up an image!! HELP!! essex_girl Java GUI 4 October 1st, 2004 03:02 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.