By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,512 Members | 3,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,512 IT Pros & Developers. It's quick & easy.

Loading only the image using javascript function

P: 2
Hi,

I need to load only the image in a JSP without refreshing the entire page.

I have an action class which sends the stream of the image and I call this action class from 'src' of <img> tag in JSP. I have two links, next and previous. Clicking on them should fetch a different image and replace the current image. Currently I'm making a fresh request and loading the entire page afresh. But I don't want to refresh the entire page but only the image portion. How can I do this? I can use javascript but not ajax.

Thanks.

Prasanna
Oct 26 '07 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

Just change the src property of the image. For example:
[HTML]<img id="image" src="img/img01.gif">[/HTML] to change the src:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("image").src="img/img02.gif";
Oct 26 '07 #2

P: 2
Yeah.. that works, thanks :)
Just for curiosity... Say I have a page which shows live quotes froma stock market (may be a market watch page) and I need to refresh it every second to get latest data. Is possible to show only the changed prices of stocks without flickering the page, using javascript?

Thanks,
Prasanna
Oct 26 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Just for curiosity... Say I have a page which shows live quotes froma stock market (may be a market watch page) and I need to refresh it every second to get latest data. Is possible to show only the changed prices of stocks without flickering the page, using javascript?
You could do, but it depends how you want it displayed within the page.
Oct 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.