ok, I am just learning this stuff, small stupid question here...I am
trying to swap images in a little ajax application, and the code
handling that looks like...
document.placeh older.src =xmlHttp.respon seText
/
no big deal i know, if i print xmlHttp.respons eText to the screen the
link is correct, but anytime I assign it as a src, i get the link+(all
the page html attached on the end) and i dont know why?
this is driving me crazy 8 2357 da***********@g mail.com said the following on 5/2/2006 11:17 AM: ok, I am just learning this stuff, small stupid question here...I am trying to swap images in a little ajax application, and the code handling that looks like...
document.placeh older.src =xmlHttp.respon seText
I hope placeholder is an image tag....
document.images['placeholder'].src is less ambiguous.
no big deal i know, if i print xmlHttp.respons eText to the screen the link is correct,
What "link" is correct? Are you trying to create a link or change an image?
but anytime I assign it as a src, i get the link+(all the page html attached on the end) and i dont know why?
Problably something in the responseText doesn't close a tag. Or,
something else is screwing it up.
Post a sample page URL that has your code in it.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
ok, since this is a little ajax thing, i have it handling the response
like this
function stateChanged()
{
if (xmlHttp.readyS tate==4 || xmlHttp.readySt ate=="complete" )
{
document.images['placeholder'].src =xmlHttp.respon seText
}
}
now, if i change it to write a message based on the xml response, it
displays like it should, only with the image it screws up...
if i just do document.write( xmlHttp.respons eText) it prints out: http://static.flickr.com/48/131196335_d17ea359ff_s.jpg ----> THIS IS
CORRECT
http://static.flickr.c om/48/131196335_d17ea 359ff_s.jpg%3C! DOCTYPE%20html% 20PUBLIC%20%22-//W3C//DTD%20XHTML%201 .0%20Transition al//EN%22%20%22http ://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d%22%3E%3Chtml% 20xmlns=%22http ://www.w3.org/1999/xhtml%22%20%3E% 3Chead%3E%3Ctit le%3EUntitled%2 0Page%3C/title%3E%3C/head%3E%3Cbody% 3E%20%20%20%20% 3Cform%20name=% 22form1%22%20me thod=%22post%22 %20action=%22da ta.aspx?q=david %22%20id=%22for m1%22%3E%3Cdiv% 3E%3Cinput%20ty pe=%22hidden%22 %20name=%22__VI EWSTATE%22%20id =%22__VIEWSTATE %22%20value=%22/wEPDwUJNzgzNDMw NTMzZGSp104ewJZ W3kxaiJAD/zBqXoBxJQ==%22% 20/%3E%3C/div%3E%20%20%20 %20%3Cdiv%3E%20 %20%20%20%20%20 %20%20%3C/div%3E%20%20%20 %20%3C/form%3E%3C/body%3E%3C/html%3E
---->this is not...
what is happening?
that didnt seem to do it...i am really confused by this, it will print
out the string fine, but as soon as I try to assing the URL to a photo
as its source, it gets jumbled...
david sargent wrote on 02 mei 2006 in comp.lang.javas cript: that didnt seem to do it...i am really confused by this, it will print out the string fine, but as soon as I try to assing the URL to a photo as its source, it gets jumbled...
Please quote what you are replying to. This is not email, but usenet.
If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers. <http://www.safalra.com/special/googlegroupsrep ly/>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
i am sorry, new to google groups...
Evertjan. wrote: david sargent wrote on 02 mei 2006 in comp.lang.javas cript:
that didnt seem to do it...i am really confused by this, it will print out the string fine, but as soon as I try to assing the URL to a photo as its source, it gets jumbled...
Please quote what you are replying to. This is not email, but usenet.
If you want to post a followup via groups.google.c om, don't use the "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers. <http://www.safalra.com/special/googlegroupsrep ly/>
-- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
david sargent said the following on 5/2/2006 5:37 PM: that didnt seem to do it...i am really confused by this, it will print out the string fine, but as soon as I try to assing the URL to a photo as its source, it gets jumbled...
I will refrain from repeating what Evertjan said about quoting, but
please don't top post either.
Try setting a variable to the responseText, alert that responseText, and
then set the src to the variable:
myVar = xmlHttp.respons eText;
alert(myVar);
alert('typeof myVar is ' + typeof(myVar));
alert('typeof xmlHttp.respons eText is ' + typeof(xmlHttp. responseText));
What do the two typeof's give you?
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
> Try setting a variable to the responseText, alert that responseText, and then set the src to the variable:
myVar = xmlHttp.respons eText; alert(myVar); alert('typeof myVar is ' + typeof(myVar)); alert('typeof xmlHttp.respons eText is ' + typeof(xmlHttp. responseText));
What do the two typeof's give you?
Both say typeof string, but when the alert(myVar) pops up, it shows the
additional text on the end...when I just do a
document.write( xmlHttp.respons eText) it gives me just the url...
david sargent wrote on 02 mei 2006 in comp.lang.javas cript: i am sorry, new to google groups...
That be as it is,
but comp.lang.javas cript is NOT a Google group,
it is a Usenet goup.
Google is only the portal you use.
Better use a dedicated news-reader.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lazarus Plath |
last post by:
I've made a gallery that has thumbnails along the top and clicking them
changes the source for the full size image below, but it seems I can't
change the image size.
A workaround I made up is to put the fullsize image tag inside a div
tag. Clicking a thumbnail changes the innerHTML of the div to an image
tag with the proper size and source.
I'm wondering if this is the way to do it or if there's a better, more
proper way?
|
by: Paolo Pignatelli |
last post by:
I am trying to get an output/file like this (below) in an XML file
(MyXmlFile.xml) (which I will use for a slide show)
--
<gallery timer="3" order="sequential" fadetime="2" looping="yes" xpos="0"
ypos="0">
<image path="images2/Test1.jpg" />
|
by: SGA Smele |
last post by:
Hello,
Now I think that there is a simple answer to my problem, but I don't
know what it is and I can't work out what I should be searching for on
the internet to read up some more about it. Here is my problem:
I have a webpage that shows a graph. The graph is a streamed image
from another webpage. This works perfectly, see code below, I have
just written some HTML to display the graph.
|
by: Maxi |
last post by:
All areas surrounded to the center area has files
Thumbnail1.jpg......Thumbnail8.jpg. What I want to do is whenever user
moves his/her mouse in Thumbnail 1 area, the center area should show
Pic1.jpg, if they move their mouse to Thumbnail 2 area, the center area
should show Pic2.jpg and so on. If there is a click in any area, then
the picture should open in a new window. Eg, user clicks on Thumbnail5
area, the new window should open...
|
by: Chuck Anderson |
last post by:
I'm using a simple, pseudo progress bar. Very simply, I display a still
image next to a form submit button until the user clicks on it, and then
I change the image source to an animated version of the still image.
Like so (I use php a lot) ...
-- the submit button and still image --
<input type=submit name="update _stats" value="Update Mailbox Stats"
class="button">
<img id="loading" src="still_image.gif">
| |
by: bulldog8 |
last post by:
I am having problems with changing a frames source file for Mozilla
(1.5.0.4). The followig code works for IE:
<script type="text/javascript">
var imgP = new Image();
function ShowPic(ShowThis, wdth, hght) {
imgP.src = "../pics/' + ShowThis + '"
xw = 500;
yh = 500*(hght/wdth);
window.document.getElementById("graphic").innerHTML = '<img src="../
|
by: dreaken667 |
last post by:
I'm using this javascript:
var curr_type="adherence";
function update(){
var r=document.getElementById("range").options;
var range=r.value;
if(range!="L7D"){
document.getElementById("compliance").disabled=false;
}else{
document.getElementById("compliance").disabled=true;
document.getElementById("adherence").checked=true;
|
by: nt5515 |
last post by:
hey Im trying to make a game of pairs (the memory game) i have set up a grid which displays a graphic for the card back. im trying to link the edit menu to choose the graphic to be displayed. i've set up a string variable called deck which will contain the path to the required image. and actionlisteners DA and DB corresponding to which style is choosen in the menu. I had to declare the deck to some initial image so it can load.
How do i...
|
by: Trastabuga |
last post by:
I have a simple task:
I need to change image src on the fly and then get its new width and
height;
var url = "/some/request";
var img = document.getElementById('my_img');
var old_width = img.width;
img.src = url; // or img.setAttribute('src', url);
//Now in browser I got a new picture
var new_width = img.width;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |