473,804 Members | 3,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in : Displaying an image and autorefresh it for every 30 seconds

10 New Member
[HTML]<HTML>
<HEAD>
<SCRIPT type="text/javascript">
var ld;
function func1()
{
var l=document.form 1.loc.value;
var d=document.form 1.degree.value;
ld=l+d;
func2();
}
function func2()
{
if (ld==chennaigra d)
{
var graph='<table> <tr><td> <img src="..... some url , which returns an image got from webservices"' >
document.writel n(graph);
document.close( );
}
}
window.setInter val("func2();", 30000);
</SCRIPT>
</HEAD>

<BODY>
<TABLE>
<FORM name="form1" action="" method="GET" onSubmit="func1 ();">

<SELECT name="loc">
<OPTION value="hyderaba d">Hyd</OPTION>
<OPTION value="banglore ">Bang</option>
<OPTION value="chennai" >Madras</option>
</SELECT>

<SELECT name="degree">
<OPTION value="grad">B. Tech</OPTION>
<OPTION value="postgrad ">M.Tech</option>
</SELECT>

<TD><input type='submit' value='Go'></TD>

</TR>
</FORM>
</TABLE>
</BODY>
</HTML>[/HTML]
Mar 12 '08 #1
8 2562
gits
5,390 Recognized Expert Moderator Expert
you shouldn't use document.write after the page is loaded ... use innerHTML instead

kind regards
Mar 12 '08 #2
alexscript
10 New Member
Thank You, I have included innerHtml now.
The problem is when i execute this in my firefox, The images are not gettinng refreshed(i mean window.setInter val() is not working). And i tried putting
<meta http-equiv="Refresh" content="30;URL =project.html"> but this is returning to the main page ie., It will again ask me to select the dropdownlist(as suming this code is named as project.html).

Is there any way ,where i can refresh only images directly. (Or )
As below, i should be able to call a function every 30seconds, ( but it is not getting the new data in this case.) When i execute this in my internet explorer, i am able to see that the images are being refreshed every 30 seconds, but to my surprise i dont see any changes in the image. I am using webservices link as image, where the url remains remain, but the graph keeps changing, but in this case it is redrawing the old image not getting the new image. When i again click on the submit button, i am able to see the new image.


Help me out..

[HTML]<HTML>
<HEAD>
<SCRIPT type="text/javascript">
var ld;
function func1()
{
var l=document.form 1.loc.value;
var d=document.form 1.degree.value;
ld=l+d;
func2();
}
function func2()
{
if (ld==chennaigra d)
{
var graph='<table> <tr><td> <img src="..... some url , which returns an image got from webservices"' >


var d=document.getE lementId("somet ext");
d.innerHTML=gra ph;

}
}
window.setInter val("func2();", 30000);
</SCRIPT>
</HEAD>

<BODY>
<TABLE>
<FORM name="form1" action="" method="GET" onSubmit="func1 ();">

<SELECT name="loc">
<OPTION value="hyderaba d">Hyd</OPTION>
<OPTION value="banglore ">Bang</option>
<OPTION value="chennai" >Madras</option>
</SELECT>

<SELECT name="degree">
<OPTION value="grad">B. Tech</OPTION>
<OPTION value="postgrad ">M.Tech</option>
</SELECT>

<TD><input type='submit' value='Go'></TD>

</TR>
</FORM>
</TABLE>

<div id="sometext">



</BODY>
</HTML>[/HTML]
Mar 13 '08 #3
gits
5,390 Recognized Expert Moderator Expert
first check this:

Expand|Select|Wrap|Line Numbers
  1. if (ld == 'chennaigrad') 
kind regards
Mar 13 '08 #4
alexscript
10 New Member
Sorry, That was my typing mistake here.

I kept those already in my program.

But still its not working..
Mar 14 '08 #5
gits
5,390 Recognized Expert Moderator Expert
you have the following errors:

please fix func2 so that graph is valid html and the method is getElementById( ):

Expand|Select|Wrap|Line Numbers
  1. function func2() {
  2.     if (ld=='chennaigrad') {
  3.         var graph ='<table><tr><td><img src="..... some url , which returns an image got from webservices"/></td></tr></table>';
  4.  
  5.         var d = document.getElementById("sometext");
  6.         d.innerHTML = graph;
  7.     }
  8.     window.setInterval("func2();",30000);
  9. }
next fix your div to a valid node:

[HTML]<div id="sometext"> </div>
[/HTML]
kind regards
Mar 14 '08 #6
alexscript
10 New Member
I did so, and i still has the problem.

Is there any way where i can reload only my images?

Here I am Calling a function for every 30 seconds and iam displaying those images in that function .

The main problem is , I am able to see the image for the first time when i click on the button, but later the function is being called but i dont see that the image is again the same. Its not getting updated?? is this any cache problem or so?? if so , how can i overcome it??


Thanks
--Alex.
Mar 14 '08 #7
gits
5,390 Recognized Expert Moderator Expert
add a unique querystring to the src:

Expand|Select|Wrap|Line Numbers
  1. src = '"your_img_src?d=' + (+ new Date) + '"';
kind regards
Mar 14 '08 #8
alexscript
10 New Member
I changed the code accordingly, but as i am using webservices url, it doesnot end with some .jpg or .gif etc., and when i am using this code for that source, i am unable to see the image at all.

What does this date function do. where can i specify the delay as 30 seconds in this. ?

[HTML]<HTML>
<HEAD>
<SCRIPT language="JavaS cript" type="text/javascript">
function func()
{

var source='"http://weeklyrose.com/images/roses.jpg?d="' + (+ new Date ) + '"';
var text='<table border="0" bordercolor="FF CC00" style="backgrou nd-color:FFFFCC" width="100%" border="4" cellpadding="3" cellspacing="3" ><tr><td> <img src='+source+'> </img></td></table>';

var d=document.getE lementById("som etext");
d.innerHTML=tex t;

}

window.setInter val("func1()",3 0000);

</SCRIPT>
</HEAD>
<BODY>
<div id="sometext">
</div>

</BODY>
</HTML>[/HTML]
Mar 15 '08 #9

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

Similar topics

2
2116
by: Just D | last post by:
Hi, I know how can I cache the ASPX page or any control on this page. But how can I refresh ASPX page automatically every xx seconds? Any script? I need my application to go to the server and reload automatically some data from the database. I can place some code to On_LOad, but I suppose that there is more official and easy way to do the same. Thanks,
4
1165
by: vbGansta | last post by:
Hi there. I am using SmartNavigation="True" in one of my pages and it is working except for one instance. If I hit the browser refresh, or a button on my form smart nav works just fine. I also have the page auto refreshing every 60 seconds. When this is fired the page scrolls back to the top. Is there anyway around this? Thanks for your help. Joe
1
1081
by: Martin Payne | last post by:
Say I want to write a page that, when delivered, displays a button labelled 'start'. When the button is pressed, a process is initiated server-side that, say, writes random values to a database table every second. And, at the same time, the page no longer displays a start button but begins displaying the contents of the database table, refreshing every 5 seconds. I have two questions. Firstly, how would I get an aspx page to kick...
2
3475
by: johnb41 | last post by:
In my app, I need to open up a multipage tiff file, and also display it's thumbnail images IN HIGH QUALITY. (High Quality meaning anti-aliased, and looking good; not rough and pixely) The thumbnail images are displayed in a ListView control. (I go through each page of the file, create a thumbnail of it, and put it into an ImageList. Then i hook that imagelist up to the ListView.) It works fine, but it is VERY slow. Creating and...
4
2224
by: matty | last post by:
Hello, here is an example of what is driving me totally crazy. This example will show that the first call to "doit()" will print 30 times the image with only one call to the server. Then I have a timeout and call doit() again, and this time, it downloads the picture 30 times!!!! It doesn't even time to finish downloading the pictures before the next timeout kicks off and if I let it go for a minute or two i have like 300 calls to...
7
3346
by: Jake Barnes | last post by:
I've a little webcam program that snaps a picture of me and uploads it every 20 seconds. It automatically uploads the image to my server. It always give the image the same name, and thus it overwrites the image that has been there for the last 20 seconds. People can, if they wish, hit the refresh button every 20 seconds, but I thought it would be fun to have a Javascript function that actually refreshed the image. However, this following...
4
2184
by: comp.lang.php | last post by:
'll try to explain this as clearly as possible, sorry if it's unclear. You have in your directory /foo 42 images You have in your database metadata for 30 out of those 42 images You have to display all 42 images in the /foo directory whether they have database metadata or not. If any of the 42 images have metadata, you must display the metadata,
23
5953
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
4
1688
by: shahidrasul | last post by:
i display a pic on picture box and then i want to display another pic after some seconds but problem is that first image is not displaying only display 2nd image 1... display first picture from database such as pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture)); 2... and then get the reference of current main thread Thread main = Thread.CurrentThread; Thread.Sleep(5000);
0
9711
marktang
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...
0
9591
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,...
0
10594
Oralloy
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...
0
10087
tracyyun
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...
1
7631
isladogs
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...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.