?
Solved

Make decisions based on content of a iframe?

Posted on 2008-11-03
23
Medium Priority
?
354 Views
Last Modified: 2012-05-05
Hello Expert,
I've got a Mobotix web cam and I would like to make a decision in a web site based on the default resolution the web cam is using. If you send a specific parameter to the cam it will tell you what resolution it is using.
The URL/parameter is:

http://192.168.1.10/control/control?read§ion=imagecontrol&size

 I think of doing this in a iframe but can't think of a way how to catch the output.

It's response will be a htm site with only this content:
Size=640x480
Or
Size=800x600

Question:

Can I based on the response make decisions in a JavaScript or ASP?
I have this script:

<script language="Javascript">
function linkr(IP){
  document.frames["iframeA"].location.href = "http://" + IP + "/control/control?set&section=general&size=800x600"
  document.frames["iframeB"].location.href = "http://" + IP + "/control/rcontrol?action=ledsdefault"
}
</script>

Now this script tells the cam to go to size 800X600 and turn its leds to default (on).
This is the case if the response would be Size=640x480 But if the response would be Size=800x600 the script should be:


<script language="Javascript">
function linkr(IP){
  document.frames["iframeA"].location.href = "http://" + IP + "/control/control?set&section=general&size=640x680"
  document.frames["iframeB"].location.href = "http://" + IP + "/control/rcontrol?action=ledsoff"
}
</script>

Thanks,

Steynsk




0
Comment
Question by:Steynsk
  • 12
  • 11
23 Comments
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22869858
just read frame  .innerHTML (after loading it.. so first attach onload event).  -> is that what you want?
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22870914
Hi wilq32:,

Yes I'll attach the complete code of both files involved. In screen touch.htm I show 12 mini screens of 12 cams in Iframe's. The mini screens are presented by view.asp and have a body onclick event. That triggers the javascript in de parent file. En in this version it is only possible to switch the cams on. But I would like to make is possible to switch them back again. But for this you need t detect the status of the cam.
And this can be done with:

http://192.168.1.10/control/control?read&section=imagecontrol&size

My Idea is create one more hidden Iframe with the URL/command in it and catch the result from the cam.
And based on that value trigger the right command in the javascript.

My knowlige of javascript little but I understand how things work.

So your help is very much appreciated,

Steynsk
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
 -------------------touch.htm----------------
<html>
<head>
<title></title>
<script language="Javascript">
function linkr(IP){
  document.frames["iframeA"].location.href = "http://" + IP + "/control/control?set&section=general&size=800x600"
  document.frames["iframeB"].location.href = "http://" + IP + "/control/rcontrol?action=ledsdefault"
}
</script>
 
</head>
<body bgcolor=black>
<table>
<tr>
<td colspan=4><iframe ID="iframeA" src ="URL1" width="0%"></iframe><iframe ID="iframeB" src ="URL2" width="0%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe1" src ="view.asp?IP=192.168.1.28&loc=Noord-1" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe2" src ="view.asp?IP=192.168.1.29&loc=Noord-2" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe3" src ="view.asp?IP=192.168.1.30&loc=Noord-3" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe4" src ="view.asp?IP=192.168.1.31&loc=Noord-4" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe5" src ="view.asp?IP=192.168.1.32&loc=Noord-5" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe6" src ="view.asp?IP=192.168.1.33&loc=Noord-6" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe7" src ="view.asp?IP=192.168.1.34&loc=Noord-7" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe8" src ="view.asp?IP=192.168.1.35&loc=Noord-8" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe9" src ="view.asp?IP=192.168.1.36&loc=Noord-9" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe10" src ="view.asp?IP=192.168.1.37&loc=Noord-10" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe11" src ="view.asp?IP=192.168.1.38&loc=Noord-11" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe12" src ="view.asp?IP=192.168.1.39&loc=Noord-12" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
<tr>
<td align=center colspan=4><img src="onbutton.jpg"></td>
</tr>
</table>
</body>
</html>
-------------------end of touch.htm-------------------------
 
--------------------view.asp----------------------------------
 
<html>
<head>
<style type="text/css">
td,th { font-family:Helvetica,Arial,sans-serif; }
pre,textarea { font-family:monospace; }
.headtablesmall { font-family:Helvetica,Arial,sans-serif; font-size:100%; }
.standard { font-size:80%; }
.inherit { font-size:100%; }
.smallcomment { font-size:95%; }
.smallercomment { font-size:80%; }
p,table,td,th{font-family:Helvetica,Arial;} 
form { margin-bottom:0px;margin-top:0px; }
.kleinerknopf { font-size:80%; }
.help { cursor:help; }
</style>
</head>
 
<body onload="if (document.all && document.all.CamPic) document.all.CamPic.style.width='auto';animation_init();"> 
 
<noscript>
        <center>
                <font face="Helvetica,Arial" size="+1" color=red>
                        Sta het gebruik van Javascripten toe om bewegend beeld te krijgen <br>Please allow the use of javascripting to receive motion picture.
                </font>
        </center>
</noscript>
 
<br><div align=center>
<form name="dkdk">
<TABLE width=320 cellpadding=0 border=0 cellspacing=0>
<TR  valign=baseline>
<td colspan=2 align=center>
<img name="CamPic" src="http://85.194.140.112/record/current.jpg?rand=6014151" ALT="Camera Live Image" TITLE="Camera Live Image" width="320" height="200"></td>
</tr>
<tr>
<td>
 
<script language="JavaScript" type="text/javascript">
        var current_refresh_method_nr=0;
        var refreshmethods_type=new Array(0,0,0,1,2);
        function refreshMethod(new_value) {
                if (refreshmethods_type[new_value]!=refreshmethods_type[current_refresh_method_nr]) {
                        var url=location.href.split("?");
                        location.href=url[0]+"?REFRESHMETHOD="+new_value;
                } else {
                        current_refresh_method_nr=new_value;
                        setframerate();
                }
        }
</script></td>
</TR>
</TABLE>
</form></div>
<script language="JavaScript">
                        var pic_url="http://85.194.140.112/record/current.jpg";
                        var noframepath="http://85.194.140.112/decor/m1m-error.jpg";
                        var n=Math.floor(Math.random()*1000000);
                        var session_id=Math.floor(Math.random()*1000000);
                        var startn=n;
                        var GetItOn=1;
                        var framerate=2;
                        var buffer= new Image();
                        var aktiv=null;
                        var db_enabled=0;
                        var passiv=null;
 
  function DoComplete()
  {
                if (db_enabled != 0) {
                        if (db_enabled<0) {
                                //document.CamPic.style.filter="";buffer.style.filter="alpha(opacity=70,style=0)";
                                document.CamPic.style.display="";
                                buffer.style.display="none";
                        } else {
                                //document.CamPic.style.filter="alpha(opacity=70,style=0)";buffer.style.filter="";
                                buffer.style.display="";
                                document.CamPic.style.display="none";
                        }
                        db_enabled*=-1;
                } else {
                document.CamPic.src = buffer.src;
                }
                GetItOn = 1;
                if (current_refresh_method_nr == 1 && framerate>0) {// Sync onload implementieren
                        if (passiv==null)
                                Animation();
                }
  }
        function LoadError()
        {
                if (db_enabled != 0) {
                        db_enabled*=-1;
                } else {
                        document.CamPic.src=noframepath;
                }
                GetItOn = 1;
                if (current_refresh_method_nr == 1 && framerate>0) // Sync onload Fehlerbehandlung
                        passiv=setTimeout("passiv=null;Animation();",1000);
        }
 
  function setframerate(value) {
                framerate=value;
                if (aktiv) {
                        window.clearInterval(aktiv);
                        aktiv = null;
                }
                document.CamPic.onerror=null;
                buffer.onerror=null;
                if (framerate<0) {
                        if (current_refresh_method_nr == 2) { //  Stream ausschalten
                                GetItOn=1; Animation();
                        }
                        return;
                }
                // Refresh Typen
                if (current_refresh_method_nr == 2) { //  Stream anschalten
                        buffer.onload = null;
                        buffer.onerror= null;
                        document.CamPic.onload=null;
                        // wg. Mozilla Bug # 42224 "Spontaner Abbruch des Streams"
                        document.CamPic.onerror= function () {setTimeout("setframerate();",500) } ;
                        document.CamPic.src = "http://85.194.140.112/cgi-bin/faststream.jpg?stream=full&fps="+framerate+"&rand=" + String(n++);
                        return;
                } else if (current_refresh_method_nr == 1) { // OnLoad synced
                        session_id++;
                        Animation();
                        return;
                }
                aktiv=window.setInterval("Animation()",1000/framerate);
                GetItOn=1;      // auf alle Faelle anzeigen!
                Animation(); // und go...
        }
  function Animation()
  {
                var my_rm_nr=current_refresh_method_nr;
                var my_fr=framerate;
                var my_session=session_id;
 
          if (GetItOn == 1 || (my_rm_nr == 1 && my_fr>0))
                        // Bild ist geladen und das naechste kann
          {     // angefordert werden.
                        GetItOn = 0;
                        if (db_enabled<0) {
                                buffer.onerror=buffer.onload=null;
                                document.CamPic.onerror= LoadError;
                                document.CamPic.onload = DoComplete;
                                if (my_rm_nr == 0)
                                        document.CamPic.src = pic_url + "?rand=" + String(n++);
                                else
                                        document.CamPic.src = pic_url + "?sync="+my_fr+"&session="+my_session+"&rand="+String(n++);
                        } else {
                                document.CamPic.onerror=document.CamPic.onload=null
                                buffer.onerror= LoadError;
                                buffer.onload = DoComplete;
                                if (my_rm_nr == 0)
                                        buffer.src = pic_url + "?rand=" + String(n++);
                                else
                                        buffer.src = pic_url + "?sync="+my_fr+"&session="+my_session+"&rand="+String(n++);
                        }
                }
  }
  function animation_init() {
                if ( document.all
                                && (navigator.platform.substr(0,3) != "Mac")
                                && (document.CamPic.inserAdjacentHTML)
                                 ) {
                        document.CamPic.insertAdjacentHTML("AfterEnd","<img border=0 style=\"display:none;\" name=dbbuffer><\/b>");
                        buffer=document.dbbuffer;
                        db_enabled=1;
                }
                setframerate(framerate);
        }
</script>
</font>
<script type='text/javascript' language='JavaScript'>self.focus();</script></body>
</html>
-----------------------end of view.asp------------------
 

Open in new window

0
 
LVL 18

Accepted Solution

by:
Pawel Witkowski earned 2000 total points
ID: 22871897
I just wonder do you know that you paste local IP adress of this site, but I assume that its only for showing link type..

What i propose in previous post, just a little more explanation:

make <iframe id="someFrame"> element

then in that frame open your page:

document.getElementById('someFrame').src='http://192.168.1.10/control/control?read§ion=imagecontrol&size';


on that page make javascript that will run function from your main script.

Script in main window:

function checkIframe()
{
alert(document.getElementById('someFrame').innerHTML)

}


and in this small iframe page:

<script type="text/javascript">
function start()
{
     window.parent.checkIframe();
}
</script>

<body onload="start()">
content here
</body>




Is that a little more clear to you ?:)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:Steynsk
ID: 22875709
Hi wilq32:
The IP in the code is only an example.

Yes that is about it . But I don't know how to implement it into my code. And I (think) I mis the decision making part in my script based on the catched value.

The value catched by :

document.getElementById('someFrame').innerHTML)

should be used to determen the value of the bold text parts in this script:

<script language="Javascript">
function linkr(IP){
  document.frames["iframeA"].location.href = "http://" + IP + "/control/control?set&section=general&size=800x600"
  document.frames["iframeB"].location.href = "http://" + IP + "/control/rcontrol?action=ledsdefault"
}
</script>
The catched value "Size=800x600" should result in the script in de values "640x480" and "ledsoff"
 The catched value "Size=640x480" should result in the script in de values "800x600" and "ledsdefault"
Thanks,
Steynsk
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22875723
Sorry posted the script twice instead of ones....
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22878620
just removed onfocus events o_O  
<html>
<head>
</head>
<body>
 <map id="imgMap" name="worldMap">
 <area shape="poly" coords="355,176,385,134,399,134,409,157,386,185,375,169,349,173" alt="Australia" href="#"  >
 <area shape="poly" coords="283,74,305,41,347,45,343,40,342,35,348,35,369,44,366,51,382,47,385,62,402,127,432,172,435,187,411,203,405,188,428,176,399,128,380,125,348,140,329,114,327,87,306,107,278,75" alt="Asia/Pac" href="#"  >
 <area shape="poly" coords="184,64,188,22,263,0,356,2,410,18,372,52,372,43,346,32,331,38,306,39,296,38,279,33,258,52,245,49,232,33,233,49,226,63,212,61,180,62" alt="Europe" href="#"  >
 <area shape="poly" coords="223,102,209,113,193,111,218,96,229,83,248,85,255,95,278,91,278,81,257,65,257,53,241,50,232,54,226,77" alt="Middle East/Africa" href="#"  >
 <area shape="poly" coords="1,27,34,5,69,5,99,0,148,0,128,21,131,44,85,79,76,78,55,78,31,68,26,56,25,31,0,37" alt="North America" href="#"  >
 <area shape="poly" coords="117,207,157,126,38,70,46,96,66,99,75,130,86,153,97,200,112,205" alt="South America" href="#"  >
</map>
 
<img src="http://www.susqu.edu/study_abroad/Images/world_map.gif" usemap="#worldMap" border="0" />
 
 
 
</body>
</html>

Open in new window

0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22878638
whops sorry for this comment it was for other window ;) let me take look at your problem
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22878674
ok instead of:
function checkIframe()
{
alert(document.getElementById('someFrame').innerHTML)

}

just do:

function checkIframe()
{
  var set;

  if (document.getElementById('someFrame').innerHTML.match('Size=800x600'))
      set=["800x600", "ledsdefault"];
  if (document.getElementById('someFrame').innerHTML.match('Size=640x480'))
      set=["640x480", "ledsoff"];
 
 document.frames["iframeA"].location.href = "http://" + IP + "/control/control?set&section=general&size="+set[0];
 document.frames["iframeB"].location.href = "http://" + IP + "/control/rcontrol?action="+set[1];
}


0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22878677
whops we forgot to set IP variable, but I hope that you can make it yourself :)
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22880572
Sorry but I can't get it working.
But maybe I misinterpreted your instructions.
This is what I did:
--------------------------------touch.htm--------------------------------------
<html>
<head>
<title></title>
<script language="Javascript">
function checkIframe(IP)
{
  document.getElementById('iframeA').src='http://" + IP + "/control/control?read&section=imagecontrol&size';
  var set;
 
  if (document.getElementById('iframeA').innerHTML.match('Size=640x480'))
      set=["800x600", "ledsoff"];
  if (document.getElementById('iframeA').innerHTML.match('Size=800x600'))
      set=["640x480", "ledsdefault"];
 
 document.frames["iframeB"].location.href = "http://" + IP + "/control/control?set&section=general&size="+set[0];
 document.frames["iframeC"].location.href = "http://" + IP + "/control/rcontrol?action="+set[1];
}
</script>
 
</head>
<body bgcolor=black>
<table>
<tr>
<td colspan=4><iframe ID="iframeA" width="0%"></iframe><iframe ID="iframeB" width="0%"></iframe><iframe ID="iframeC" width="0%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe1" src ="view.asp?IP=192.168.1.228&loc=Noord-1" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe2" src ="view.asp?IP=192.168.1.229&loc=Noord-2" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe3" src ="view.asp?IP=192.168.1.230&loc=Noord-3" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe4" src ="view.asp?IP=192.168.1.231&loc=Noord-4" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe5" src ="view.asp?IP=192.168.1.232&loc=Noord-5" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe6" src ="view.asp?IP=192.168.1.233&loc=Noord-6" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe7" src ="view.asp?IP=192.168.1.234&loc=Noord-7" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe8" src ="view.asp?IP=192.168.1.235&loc=Noord-8" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
<tr>
<td><iframe ID="iframe9" src ="view.asp?IP=192.168.1.236&loc=Noord-9" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe10" src ="view.asp?IP=192.168.1.237&loc=Noord-10" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe11" src ="view.asp?IP=192.168.1.238&loc=Noord-11" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
<td><iframe ID="iframe12" src ="view.asp?IP=192.168.1.239&loc=Noord-12" scrolling=no border="0" frameborder="0" width="100%"></iframe></td>
</tr>
</table>
</body>
</html>
--------------------------------------------end of touch.htm---------------------------------
---------------------------------------------view.asp---------------------------------------
<html>
<head>
</head>
 
<body onload="if (document.all && document.all.CamPic) document.all.CamPic.style.width='auto';animation_init();"> 
 
<noscript>
        <center>
                <font face="Helvetica,Arial" size="+1" color=red>
                        Sta het gebruik van Javascripten toe om bewegend beeld te krijgen <br>Please allow the use of javascripting to receive motion picture.
                </font>
        </center>
</noscript>
 
<br><div align=center>
<form name="dkdk">
<TABLE width=320 cellpadding=0 border=0 cellspacing=0>
<TR  valign=baseline>
<td colspan=2 align=center>
<img name="CamPic" src="http://85.194.140.112/record/current.jpg?rand=6014151" ALT="Camera Live Image" TITLE="Camera Live Image" width="320" height="200"></td>
</tr>
<tr>
<td>
 
<script language="JavaScript" type="text/javascript">
        var current_refresh_method_nr=0;
        var refreshmethods_type=new Array(0,0,0,1,2);
        function refreshMethod(new_value) {
                if (refreshmethods_type[new_value]!=refreshmethods_type[current_refresh_method_nr]) {
                        var url=location.href.split("?");
                        location.href=url[0]+"?REFRESHMETHOD="+new_value;
                } else {
                        current_refresh_method_nr=new_value;
                        setframerate();
                }
        }
</script></td>
</TR>
</TABLE>
</form></div>
<script language="JavaScript">
                        var pic_url="http://85.194.140.112/record/current.jpg";
                        var noframepath="http://85.194.140.112/decor/m1m-error.jpg";
                        var n=Math.floor(Math.random()*1000000);
                        var session_id=Math.floor(Math.random()*1000000);
                        var startn=n;
                        var GetItOn=1;
                        var framerate=2;
                        var buffer= new Image();
                        var aktiv=null;
                        var db_enabled=0;
                        var passiv=null;
 
  function DoComplete()
  {
                if (db_enabled != 0) {
                        if (db_enabled<0) {
                                //document.CamPic.style.filter="";buffer.style.filter="alpha(opacity=70,style=0)";
                                document.CamPic.style.display="";
                                buffer.style.display="none";
                        } else {
                                //document.CamPic.style.filter="alpha(opacity=70,style=0)";buffer.style.filter="";
                                buffer.style.display="";
                                document.CamPic.style.display="none";
                        }
                        db_enabled*=-1;
                } else {
                document.CamPic.src = buffer.src;
                }
                GetItOn = 1;
                if (current_refresh_method_nr == 1 && framerate>0) {// Sync onload implementieren
                        if (passiv==null)
                                Animation();
                }
  }
        function LoadError()
        {
                if (db_enabled != 0) {
                        db_enabled*=-1;
                } else {
                        document.CamPic.src=noframepath;
                }
                GetItOn = 1;
                if (current_refresh_method_nr == 1 && framerate>0) // Sync onload Fehlerbehandlung
                        passiv=setTimeout("passiv=null;Animation();",1000);
        }
 
  function setframerate(value) {
                framerate=value;
                if (aktiv) {
                        window.clearInterval(aktiv);
                        aktiv = null;
                }
                document.CamPic.onerror=null;
                buffer.onerror=null;
                if (framerate<0) {
                        if (current_refresh_method_nr == 2) { //  Stream ausschalten
                                GetItOn=1; Animation();
                        }
                        return;
                }
                // Refresh Typen
                if (current_refresh_method_nr == 2) { //  Stream anschalten
                        buffer.onload = null;
                        buffer.onerror= null;
                        document.CamPic.onload=null;
                        // wg. Mozilla Bug # 42224 "Spontaner Abbruch des Streams"
                        document.CamPic.onerror= function () {setTimeout("setframerate();",500) } ;
                        document.CamPic.src = "http://85.194.140.112/cgi-bin/faststream.jpg?stream=full&fps="+framerate+"&rand=" + String(n++);
                        return;
                } else if (current_refresh_method_nr == 1) { // OnLoad synced
                        session_id++;
                        Animation();
                        return;
                }
                aktiv=window.setInterval("Animation()",1000/framerate);
                GetItOn=1;      // auf alle Faelle anzeigen!
                Animation(); // und go...
        }
  function Animation()
  {
                var my_rm_nr=current_refresh_method_nr;
                var my_fr=framerate;
                var my_session=session_id;
 
          if (GetItOn == 1 || (my_rm_nr == 1 && my_fr>0))
                        // Bild ist geladen und das naechste kann
          {     // angefordert werden.
                        GetItOn = 0;
                        if (db_enabled<0) {
                                buffer.onerror=buffer.onload=null;
                                document.CamPic.onerror= LoadError;
                                document.CamPic.onload = DoComplete;
                                if (my_rm_nr == 0)
                                        document.CamPic.src = pic_url + "?rand=" + String(n++);
                                else
                                        document.CamPic.src = pic_url + "?sync="+my_fr+"&session="+my_session+"&rand="+String(n++);
                        } else {
                                document.CamPic.onerror=document.CamPic.onload=null
                                buffer.onerror= LoadError;
                                buffer.onload = DoComplete;
                                if (my_rm_nr == 0)
                                        buffer.src = pic_url + "?rand=" + String(n++);
                                else
                                        buffer.src = pic_url + "?sync="+my_fr+"&session="+my_session+"&rand="+String(n++);
                        }
                }
  }
  function animation_init() {
                if ( document.all
                                && (navigator.platform.substr(0,3) != "Mac")
                                && (document.CamPic.inserAdjacentHTML)
                                 ) {
                        document.CamPic.insertAdjacentHTML("AfterEnd","<img border=0 style=\"display:none;\" name=dbbuffer><\/b>");
                        buffer=document.dbbuffer;
                        db_enabled=1;
                }
                setframerate(framerate);
        }
</script>
</font>
<script type='text/javascript' language='JavaScript'>self.focus();</script></body>
</html>
------------------------end of view.asp--------------------------

Open in new window

0
 
LVL 1

Author Comment

by:Steynsk
ID: 22880641
Sorry I did use

<body bgcolor=black onclick="parent.linkr('<% response.write IP %>');"
But that did not solve the problem.
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22882059
just add alert (IP) at the begining of function, and check is function takes proper argument, then you have to check is this function being started from test script, and make sure that you opened this test script - because it opens this function
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22886197
Wilq32,

The command alert(IP) return the IP as expected. While the command:
alert(document.getElementById('iframeA').innerHTML)
Does not return a value but an empty msbox.

Do you have any ideas?

Kind regards,

Steynsk

0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22886470
try alert(document.getElementById('iframeA').contentDocument.body.innerHTML)
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22886528
It looks like the site being read before it has content. How do I add a sleep before reading it?
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22886648
Adding

setTimeout("alert(document.getElementById('iframeA').innerHTML)",5000);

Does result in the Iframe prsenting the wanted information but the alert not showing it...
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22886723
did you try mine last line of code? is it working ?
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22886756
And no

alert(document.getElementById('iframeA').contentDocument.body.innerHTML)

does not return a eny result. Not even a msbox...
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22893098
Hmmm thats odd. Lets check everything from begining. Check that onload on "checking" (that will return Size=800x600) page work. It should fire window.parent.checkIframe() so a function from parent window. Put an alert at the begining of checkIframe in main window and see is it fired after opening "checking" page in frame. If yes then check one most important thing. If your "checking" page is on other domain that your main page - it will not work, because of security polices that prevent reading from contentDocument.body. So if you main page is:

localhost/main.html

and your checking is

someadress.net/check.html

Then it wont work. You have to make sure that its on one server - if not you have two choices:
- server side: open the page from server side and depending on its content put needed information,
- client side: use dynamic javascript includes (require that you have access to "checking" page)
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22895832
wilq32,

Yes you probably right. The script could possibly not detect it ha to read a page on the same domain becouse the webserver is a domain member and the web cam that has to produce the output is not.

In the meaintime I've found out that ASP can solve my problem. I include the code.
But this code has odd things aswel becouse it produces output but I cant work with it....

the code beneith is producing the output:

size=640x480 False

and it should produce

size=640x480 True

Do you have a ideas what could couse this?


<%
Response.Buffer = true
Dim objXMLHTTP, xml, text
dim mystring
Set xml = Server.CreateObject ("Microsoft.XMLHTTP")
'Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open "GET", "http://192.168.1.10/control/control?read&section=imagecontrol&size", False
xml.Send
mystring = LCase(trim(cstr(xml.responseText)))
response.write mystring
  if mystring = "size=640x480" then
response.write "True"
else
response.write "False"
end if
Set xml = Nothing
%>

Open in new window

0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22899464
hmm as i remember there was "Size=640x480" not "size=640x480"  am i wrong ?
0
 
LVL 1

Author Comment

by:Steynsk
ID: 22899886
Yes you are right. But does not matter.

But I found this script and it does the job. I don't know exactly what solves it but I can go on.

Thanks a lot for all your help.

Steynsk
<% 
    url = "http://192.168.1.10/control/control?read&section=imagecontrol&size"  
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")  
    on error resume next 
    xmlhttp.open "GET", url, false 
    xmlhttp.send ""  
        if instr(xmlhttp.responseText,"640x480")>0 then 
            response.write "It works" 
        else 
            response.write "No luck" 
        end if 
 
    set xmlhttp = nothing 
%>

Open in new window

0
 
LVL 1

Author Closing Comment

by:Steynsk
ID: 31512775
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question