W
willie
hi dear committee here,
Recently I am trying to writing a widget with will request a gif file
from the server. I have done most of the work and the server now is
sending back the gif file with the following header:
Server: Microsoft-IIS/5.0 Cache-Control: private Date: Fri, 23 Sep 2005
13:16:29 GMT Content-Length: 154 Content-Type: image/gif Via: 1.1
zproxy (NetCache NetApp/5.5R3D2)
However, when I use the code below to set the image to correscponding
element, it just doesn't show:
//code to set gif to image element
document.getElementById("spamcode").src = req.responseText;
I have tried to view the responseText in a div area using the
following code:
//show content of sent back gif file
document.getElementById("indicator").innerHTML = req. responseText();
and it simply give me a string like this:
GIF89a ñÿÿÿÿÿÿ!ù,
k"(¢D%JQ¢D€J(¢DˆB"Q"DJ(P¢@‰%B"Q"Dˆ!J,,(P¢@‰J(Q
Dˆ! P"D‰J(Q¢@‰% "Q"D‰!JP¢D€U;
I am quite new to javascript and just get my hand on the
XMLHttpRequest. Tried a lot of method like:
document.getElementById("spamcode").src =
"data:image/gif,base64;"+req.responseText;
But still, I am no lucky.
I am not sure whether it is because of the decoding problem because I
searched the web and the GIF89a file content always shows like
GIF89a\1\0\1\0\200[...]\1\0;
Hope you exports could give me some way to solve this problem,
anyway, school final exam is coming..
regards,
Liao Liang
Nanyang Technological University
Recently I am trying to writing a widget with will request a gif file
from the server. I have done most of the work and the server now is
sending back the gif file with the following header:
Server: Microsoft-IIS/5.0 Cache-Control: private Date: Fri, 23 Sep 2005
13:16:29 GMT Content-Length: 154 Content-Type: image/gif Via: 1.1
zproxy (NetCache NetApp/5.5R3D2)
However, when I use the code below to set the image to correscponding
element, it just doesn't show:
//code to set gif to image element
document.getElementById("spamcode").src = req.responseText;
I have tried to view the responseText in a div area using the
following code:
//show content of sent back gif file
document.getElementById("indicator").innerHTML = req. responseText();
and it simply give me a string like this:
GIF89a ñÿÿÿÿÿÿ!ù,
k"(¢D%JQ¢D€J(¢DˆB"Q"DJ(P¢@‰%B"Q"Dˆ!J,,(P¢@‰J(Q
Dˆ! P"D‰J(Q¢@‰% "Q"D‰!JP¢D€U;
I am quite new to javascript and just get my hand on the
XMLHttpRequest. Tried a lot of method like:
document.getElementById("spamcode").src =
"data:image/gif,base64;"+req.responseText;
But still, I am no lucky.
I am not sure whether it is because of the decoding problem because I
searched the web and the GIF89a file content always shows like
GIF89a\1\0\1\0\200[...]\1\0;
Hope you exports could give me some way to solve this problem,
anyway, school final exam is coming..
regards,
Liao Liang
Nanyang Technological University