Click here to Skip to main content
15,900,906 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionCapturing a function Pin
Vodstok24-Sep-10 4:08
Vodstok24-Sep-10 4:08 
AnswerRe: Capturing a function Pin
Not Active24-Sep-10 4:34
mentorNot Active24-Sep-10 4:34 
GeneralRe: Capturing a function Pin
Vodstok24-Sep-10 4:40
Vodstok24-Sep-10 4:40 
AnswerRe: Capturing a function Pin
Gerben Jongerius26-Sep-10 21:45
Gerben Jongerius26-Sep-10 21:45 
QuestionFree Javascript Web Site Pin
jaglenn23-Sep-10 10:22
jaglenn23-Sep-10 10:22 
AnswerRe: Free Javascript Web Site Pin
DaveAuld23-Sep-10 10:25
professionalDaveAuld23-Sep-10 10:25 
GeneralRe: Free Javascript Web Site Pin
jimbo809830-Sep-10 3:38
jimbo809830-Sep-10 3:38 
QuestionChanging Image Source w/ Interlaced PNG [modified] Pin
Skippums22-Sep-10 4:04
Skippums22-Sep-10 4:04 
I would like to replace one interlaced image with another depending on the value a client selects from a dropdown. I currently have it working in that it replaces the image, but the new image isn't displayed until the entire image file has been transferred from the server. I am wondering if there is a way to display the new image as it is downloaded since it is an interlaced png file? My current javascript code is as follows:
// File: Sample.js
function ShowImage() {
    var selElmt   = document.getElementById('dropdown');
    var selection = selElmt.options[selElmt.selectedIndex].text;
    document.images['mainImg'].src = selection + '.png';
}
And the associated HTML is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
  <head>
    <title>Image Selector</title>
    <script type="text/javascript" src ="Sample.js"></script>
    <meta http-equiv="Content-Language" content="en-us"                 />
    <meta http-equiv="Content-Type"     content="application/xhtml+xml" />
  </head>
  <body onload="ShowImage();">
    <select onchange="ShowImage();" id="dropdown" name="dropdown">
      <option>Image1</option>
      <option>Image2</option>
      <option>Image3</option>
    </select>
    <img id="mainImg" src="" width="100%" title="Sample Image" alt="Sample Image" />
  </body>
</html>
I know that I could pre-load the images if there were only a few options (as in the example), but I have hundreds of thousands of images which makes that approach unfeasible. Most users will only view about 10 of the possible images, and there will be no pattern to their access so I can't try to predict which images will be accessed. The issue that I am attempting to solve is that when I first load the page, the image loads as it is downloaded (ie, I get a low-resolution image displayed immediately, followed by improved resolution as the interlaced pixels arrive). However, all subsequent calls to the function "ShowImage();" on the "onchange" event of the select object waits to display the image until the file has been downloaded from the server in its entirety. Is there some way to make the "onchange" event show the new interlaced image as it is downloaded?

BEGIN EDIT

I am seeing this behavior in Firefox, but in IE7 it does display the image in an interlaced fashion. However, IE7 only downloads one image at a time since I am really displaying multiple images simulteaneously. So I guess the question is, is there a way in IE7 to download/display all images simultaneously, and for FF is there a way to display the images as they are downloaded? Thanks in advance for any help,

END EDIT
Sounds like somebody's got a case of the Mondays

-Jeff
modified on Wednesday, September 22, 2010 10:41 AM

AnswerRe: Changing Image Source w/ Interlaced PNG Pin
Sunasara Imdadhusen21-Oct-10 2:41
professionalSunasara Imdadhusen21-Oct-10 2:41 
GeneralRe: Changing Image Source w/ Interlaced PNG Pin
Skippums28-Oct-10 10:52
Skippums28-Oct-10 10:52 
QuestionAjax and JavaScript Pin
future383922-Sep-10 1:29
future383922-Sep-10 1:29 
AnswerRe: Ajax and JavaScript Pin
Richard MacCutchan22-Sep-10 1:48
mveRichard MacCutchan22-Sep-10 1:48 
AnswerRe: Ajax and JavaScript Pin
thatraja22-Sep-10 1:49
professionalthatraja22-Sep-10 1:49 
Questionp3p Header Pin
salmonraju20-Sep-10 23:33
salmonraju20-Sep-10 23:33 
Questionreattaching an html element. Pin
swjam20-Sep-10 16:16
swjam20-Sep-10 16:16 
AnswerRe: reattaching an html element. Pin
Not Active21-Sep-10 2:32
mentorNot Active21-Sep-10 2:32 
GeneralRe: reattaching an html element. Pin
swjam21-Sep-10 4:14
swjam21-Sep-10 4:14 
GeneralRe: reattaching an html element. Pin
Not Active21-Sep-10 4:57
mentorNot Active21-Sep-10 4:57 
QuestionIndicating a button has been pushed Pin
bklerner14-Sep-10 8:29
bklerner14-Sep-10 8:29 
AnswerRe: Indicating a button has been pushed Pin
Skippums22-Sep-10 4:15
Skippums22-Sep-10 4:15 
Questiondynamic event - pass value Pin
Hanzaplast14-Sep-10 2:29
Hanzaplast14-Sep-10 2:29 
AnswerRe: dynamic event - pass value [modified] Pin
daveyerwin14-Sep-10 5:47
daveyerwin14-Sep-10 5:47 
GeneralRe: dynamic event - pass value Pin
Hanzaplast14-Sep-10 23:34
Hanzaplast14-Sep-10 23:34 
QuestionjQuery/jTemplate question [Solved] Pin
RCoate9-Sep-10 18:52
RCoate9-Sep-10 18:52 
AnswerRe: jQuery/jTemplate question Pin
Pete O'Hanlon15-Sep-10 0:47
mvePete O'Hanlon15-Sep-10 0:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.