Hen cam motion on website page

We have two camera on our backyard hens. They are set to refresh every 3 seconds. One shows "outside" view. One shows "nest boxes". We have gotten the "outside" to refresh but there seems to be a conflict in the javascript, not allowing the "nest boxes" to refresh. We are total amateurs at code, so patience is required.

You can see the website at backyardhencam.com.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Copy and paste my code in, i tested it and it's working, if you add more cameras to make them all refresh just change the refresh function to handle the new camera.
<script language="javascript"> 
var refreshrate=3;                 //SECONDS BETWEEN REFRESH
var image="http://hencam1.viewnetcam.com:5002/SnapshotJPEG?Resolution=640x480&amp;Quality=Standard";     //IMAGE NAME
var imgheight=480;                   //IMAGE HEIGHT
var imgwidth=640;                 //IMAGE WIDTH
document.write('<IMG SRC="'+image+'" ALT="Chicken Coup" NAME="pic" ID="pic" WIDTH="'+imgwidth+'" HEIGHT="'+imgheight+'" BORDER="0">');

<h4>If screen is dark, shhhhhhh&#8230;hens are sleeping.</h4>
<script language="javascript"> 
var refreshrate2=3;                 //SECONDS BETWEEN REFRESH
var image2="http://hencam2.viewnetcam.com:5003/SnapshotJPEG?Resolution=320x240&amp;Quality=Standard";     //IMAGE NAME
var imgheight2=480;                   //IMAGE HEIGHT
var imgwidth2=640;                 //IMAGE WIDTH
document.write('<IMG SRC="'+image2+'" ALT="Nestboxes" NAME="pic2" ID="pic2" WIDTH="'+imgwidth2+'" HEIGHT="'+imgheight2+'" BORDER="0">');

function refresh(){
document.images["pic"].src=image+"?"+new Date();
document.images["pic2"].src=image2+"?"+new Date();
setTimeout('refresh()', refreshrate2*1000);}



Open in new window

actually I just noticed you have multiple refresh rates, you only need one var for it so in my code delete
var refreshrate2=3;                 //SECONDS BETWEEN REFRESH

and change
setTimeout('refresh()', refreshrate2*1000);} to setTimeout('refresh()', refreshrate*1000);}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeeOlAuthor Commented:
Can't wait to see if this works. Thank you!

It will take me a little time to do this. I'm very inexperienced at this code thing. Will let you know as soon as I try it.
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

LeeOlAuthor Commented:
Wow! I got my son to paste your code in for me and it works beautifully! Can't thank you enough for your expertise!
LeeOlAuthor Commented:
I can't believe that something I've worked on for two months was solved in less than an hour! Amazing!
Your very welcome!
BTW, you may want to check into adding Google Analytics to your website. It will tell you where your users are coming from, how many hits your getting a day, how you stack up against other websites and a whole slew of other useful data. Not to mention it's free, you just drop a bit of code they give you onto the end of your webpage and your ready. Usually updates every 24hrs.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.