Hi All,
My question is following : I have code snippet as follows :
- var i = 0;
- function func2() {
- if (i==0){
- document.getElementById('frame1').contentWindow.opts[selected].setAttribute('name','channels');
- var strValue = document.getElementById('frame1').contentWindow.opts[selected].getAttribute('name');
- //alert("Attribute value set :" + strValue);
- document.getElementById('frame1').contentWindow.handleKeyCode(VK_ENTER);
- i++;
- }
- else if(i==1){
- // For Channels section -- "Get current channel details"
- document.getElementById('frame1').contentWindow.opts[selected].setAttribute('name','get');
- var strValue = document.getElementById('frame1').contentWindow.opts[selected].getAttribute('name');
- //alert("Attribute value set :" + strValue);
- document.getElementById('frame1').contentWindow.handleKeyCode(VK_ENTER);
- i++;
- }
- else if(i==2){
- // For Channels section -- "Set current channel details"
- document.getElementById('frame1').contentWindow.opts[selected].setAttribute('name','set');
- document.getElementById('frame1').contentWindow.menuSelect(1);
- var strValue = document.getElementById('frame1').contentWindow.opts[selected].getAttribute('name');
- //alert("Attribute value set :" + strValue);
- document.getElementById('frame1').contentWindow.handleKeyCode(VK_ENTER);
- i++;
- }
- }
- $(function() {
- setInterval(function(){func2();}, 1000);
- });
In this the setInterval works only once i.e it executes only the first if condition. But as I enables the "alert" messages of all the conditions then the setInterval works fine.
I don't want the "Alert Messages" for this setInterval if conditions, it should execute each if elseif statment as per the condition and at given time interval.
I am unable to achieve this. Also i didn't find any satisfactory reference from the setInterval related questions in this forum. Please help.
Thanks.