Other [ABMaterial] Dynamically change the content of the front-end web page

jinyistudio

Well-Known Member
Licensed User
I can change <object? html file in root html file from server side but i cann't call setValue from server side by websocket ? because i don't know how to access led1.html and then call setValue in the <object> tag ?o_O

root html file(web socket client)
B4X:
<div id="container">
    <object id="panel" width="100%" height="100%" data="led1.html"></object>
</div>

child html file
B4X:
<script type="text/javascript">
        function [B][COLOR=rgb(226, 80, 65)][B]setValue[/B][/COLOR][/B](id,value) {
        console.log('id: ' + id + ', value: ' + value);   
        graphic.setValue(id, value);               
    }
</script>

How to call setValue function inside root html file from server side with websocket? o_O
 

jinyistudio

Well-Known Member
Licensed User
sorry, i get this and it is OK 😭

B4X:
var n1=1;
             var b1=false;
            setInterval(function(){
                [B]document.getElementById('panel').contentWindow.graphic.setValue('led1', b1);[/B]
                b1=!b1;
               [B] document.getElementById('panel').contentWindow.setValue('sw1', n1);[/B]              
                 n1=n1+1;
                 if(n1>3) n1=1;
            }, 3000);
 
Upvote 0
Top