Connecting Tech Pros Worldwide Help | Site Map

JAVASCRIPT recusive function

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 02:31 PM
Bartosz Wegrzyn
Guest
 
Posts: n/a
Default JAVASCRIPT recusive function

Any ideas why this function is not working.
I am running it locally on my private network.


<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Javascript Webcam for Internet Explorer</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

<script LANGUAGE="JavaScript">
<!-- hide from old browsers
var chgcntr=1;

currentdate = new Date();
currenttime = currentdate.getTime();


function changeit() {
if (chgcntr > 0) {
var imgsingle = "http://192.168.0.1/webcam/webcam.jpeg";

document.imgroom.src = imgsingle;
setTimeout("changeit()",3000);
}
}
//end hide -->
</script>

</head>
<body text="#000066" bgcolor="#FFFFFF" link="#0066FF" vlink="#00AAFF"
alink="#FF0000" onload="changeit()">

<center>
<IMG src="" name="imgroom" alt="Picture" height=240 width=320></img>


</center>
</body>
</html>


Thanks

  #2  
Old July 20th, 2005, 02:31 PM
mscir
Guest
 
Posts: n/a
Default Re: JAVASCRIPT recusive function

Bartosz Wegrzyn wrote:[color=blue]
> Any ideas why this function is not working.
> I am running it locally on my private network.
>
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> <head>
> <title>Javascript Webcam for Internet Explorer</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
>
> <script LANGUAGE="JavaScript">
> <!-- hide from old browsers
> var chgcntr=1;
>
> currentdate = new Date();
> currenttime = currentdate.getTime();
>
>
> function changeit() {
> if (chgcntr > 0) {
> var imgsingle = "http://192.168.0.1/webcam/webcam.jpeg";
>
> document.imgroom.src = imgsingle;
> setTimeout("changeit()",3000);
> }
> }
> //end hide -->
> </script>
>
> </head>
> <body text="#000066" bgcolor="#FFFFFF" link="#0066FF" vlink="#00AAFF"
> alink="#FF0000" onload="changeit()">
>
> <center>
> <IMG src="" name="imgroom" alt="Picture" height=240 width=320></img>
>
>
> </center>
> </body>
> </html>[/color]

If you go to this url in your browser do you see an image at
http://192.168.0.1/webcam/webcam.jpeg?

Mike

  #3  
Old July 20th, 2005, 02:31 PM
Chris Crandell
Guest
 
Posts: n/a
Default Re: JAVASCRIPT recusive function


mscir <mscir@access4less.net> wrote in message
news:102qpheg2g26457@corp.supernews.com...[color=blue]
> Bartosz Wegrzyn wrote:[color=green]
> > Any ideas why this function is not working.
> > I am running it locally on my private network.
> >
> >
> > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > <html>
> > <head>
> > <title>Javascript Webcam for Internet Explorer</title>
> > <meta http-equiv="Content-Type" content="text/html;
> > charset=iso-8859-1">
> >
> > <script LANGUAGE="JavaScript">
> > <!-- hide from old browsers
> > var chgcntr=1;
> >
> > currentdate = new Date();
> > currenttime = currentdate.getTime();
> >
> >
> > function changeit() {
> > if (chgcntr > 0) {
> > var imgsingle = "http://192.168.0.1/webcam/webcam.jpeg";
> >
> > document.imgroom.src = imgsingle;
> > setTimeout("changeit()",3000);
> > }
> > }
> > //end hide -->
> > </script>
> >
> > </head>
> > <body text="#000066" bgcolor="#FFFFFF" link="#0066FF" vlink="#00AAFF"
> > alink="#FF0000" onload="changeit()">
> >
> > <center>
> > <IMG src="" name="imgroom" alt="Picture" height=240 width=320></img>
> >
> >
> > </center>
> > </body>
> > </html>[/color]
>
> If you go to this url in your browser do you see an image at
> http://192.168.0.1/webcam/webcam.jpeg?
>
> Mike
>[/color]

Hi,
I guess it's on his private network and not viewable to us.

For test purposes I modified the code slightly to see what I could see.
With the modified changeit() below and 2 images in the same directory as my
html,
I see the alt "text" incrementing and the pictures swapping every 3 seconds.

As noted in other posts, it is always helpful to provide
a more detailed description than "not working".

function changeit() {
if (chgcntr++ > 0) {
var imgsingle0 = "catnglasses.jpg";
var imgsingle1 = "catnfood.jpg";

if (chgcntr % 2 == 0) document.imgroom.src = imgsingle0;
else document.imgroom.src = imgsingle1;

document.imgroom.alt=chgcntr;
setTimeout("changeit()",3000);
}
}


  #4  
Old July 20th, 2005, 02:31 PM
mscir
Guest
 
Posts: n/a
Default Re: JAVASCRIPT recusive function


Chris Crandell wrote:[color=blue]
> mscir <mscir@access4less.net> wrote in message
> news:102qpheg2g26457@corp.supernews.com...
>[color=green]
>>Bartosz Wegrzyn wrote:
>>[color=darkred]
>>>Any ideas why this function is not working.
>>>I am running it locally on my private network.
>>>
>>>
>>><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
>>><html>
>>><head>
>>><title>Javascript Webcam for Internet Explorer</title>
>>><meta http-equiv="Content-Type" content="text/html;
>>>charset=iso-8859-1">
>>>
>>><script LANGUAGE="JavaScript">
>>><!-- hide from old browsers
>>>var chgcntr=1;
>>>
>>>currentdate = new Date();
>>>currenttime = currentdate.getTime();
>>>
>>>
>>>function changeit() {
>>>if (chgcntr > 0) {
>>>var imgsingle = "http://192.168.0.1/webcam/webcam.jpeg";
>>>
>>>document.imgroom.src = imgsingle;
>>>setTimeout("changeit()",3000);
>>>}
>>>}
>>>//end hide -->
>>></script>
>>>
>>></head>
>>><body text="#000066" bgcolor="#FFFFFF" link="#0066FF" vlink="#00AAFF"
>>>alink="#FF0000" onload="changeit()">
>>>
>>><center>
>>><IMG src="" name="imgroom" alt="Picture" height=240 width=320></img>
>>>
>>>
>>></center>
>>></body>
>>></html>[/color]
>>
>>If you go to this url in your browser do you see an image at
>>http://192.168.0.1/webcam/webcam.jpeg?
>>
>>Mike
>>[/color]
>
>
> Hi,
> I guess it's on his private network and not viewable to us.
> For test purposes I modified the code slightly to see what I could see.
> With the modified changeit() below and 2 images in the same directory as my
> html,
> I see the alt "text" incrementing and the pictures swapping every 3 seconds.
>
> As noted in other posts, it is always helpful to provide
> a more detailed description than "not working".
>
> function changeit() {
> if (chgcntr++ > 0) {
> var imgsingle0 = "catnglasses.jpg";
> var imgsingle1 = "catnfood.jpg";
>
> if (chgcntr % 2 == 0) document.imgroom.src = imgsingle0;
> else document.imgroom.src = imgsingle1;
>
> document.imgroom.alt=chgcntr;
> setTimeout("changeit()",3000);
> }
> }[/color]


Hi Chris,

That's what I thought too (image is only accessible on his local
network), but I though I'd better ask him to make sure the image really
exists at that location, is spelled right, etc.... the code looks okay
to me (I'm no expert though).

Mike

  #5  
Old July 20th, 2005, 02:31 PM
Bartosz Wegrzyn
Guest
 
Posts: n/a
Default Re: JAVASCRIPT recusive function

Thanks for your help, but unfortunetaly even you code did not work.

I erased the htm file and I created a new one and it helped.

Thank You

"Chris Crandell" <ccrandel@ix.netcom.com> wrote in message news:<BwjXb.3508$WW3.2911@newsread2.news.pas.earth link.net>...[color=blue]
> mscir <mscir@access4less.net> wrote in message
> news:102qpheg2g26457@corp.supernews.com...[color=green]
> > Bartosz Wegrzyn wrote:[color=darkred]
> > > Any ideas why this function is not working.
> > > I am running it locally on my private network.
> > >
> > >
> > > <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> > > <html>
> > > <head>
> > > <title>Javascript Webcam for Internet Explorer</title>
> > > <meta http-equiv="Content-Type" content="text/html;
> > > charset=iso-8859-1">
> > >
> > > <script LANGUAGE="JavaScript">
> > > <!-- hide from old browsers
> > > var chgcntr=1;
> > >
> > > currentdate = new Date();
> > > currenttime = currentdate.getTime();
> > >
> > >
> > > function changeit() {
> > > if (chgcntr > 0) {
> > > var imgsingle = "http://192.168.0.1/webcam/webcam.jpeg";
> > >
> > > document.imgroom.src = imgsingle;
> > > setTimeout("changeit()",3000);
> > > }
> > > }
> > > //end hide -->
> > > </script>
> > >
> > > </head>
> > > <body text="#000066" bgcolor="#FFFFFF" link="#0066FF" vlink="#00AAFF"
> > > alink="#FF0000" onload="changeit()">
> > >
> > > <center>
> > > <IMG src="" name="imgroom" alt="Picture" height=240 width=320></img>
> > >
> > >
> > > </center>
> > > </body>
> > > </html>[/color]
> >
> > If you go to this url in your browser do you see an image at
> > http://192.168.0.1/webcam/webcam.jpeg?
> >
> > Mike
> >[/color]
>
> Hi,
> I guess it's on his private network and not viewable to us.
>
> For test purposes I modified the code slightly to see what I could see.
> With the modified changeit() below and 2 images in the same directory as my
> html,
> I see the alt "text" incrementing and the pictures swapping every 3 seconds.
>
> As noted in other posts, it is always helpful to provide
> a more detailed description than "not working".
>
> function changeit() {
> if (chgcntr++ > 0) {
> var imgsingle0 = "catnglasses.jpg";
> var imgsingle1 = "catnfood.jpg";
>
> if (chgcntr % 2 == 0) document.imgroom.src = imgsingle0;
> else document.imgroom.src = imgsingle1;
>
> document.imgroom.alt=chgcntr;
> setTimeout("changeit()",3000);
> }
> }[/color]
  #6  
Old July 20th, 2005, 02:31 PM
mscir
Guest
 
Posts: n/a
Default Re: JAVASCRIPT recusive function

Bartosz Wegrzyn wrote:[color=blue]
> Thanks for your help, but unfortunetaly even you code did not work.
> I erased the htm file and I created a new one and it helped.[/color]

Okay, what was it that made it work?

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.