How can I change contents of X3D scene via Javascript with PHP or HTML load?

382 Views Asked by At

I want to create a scene on X3D with calls to HTML or PHP script. For changing the content of the scene. The question is rather simple and interesting. It's different from another one cause of adding details about code and concrete question on how to load x3d into the browser. The code example here is rather different comparing my other question.

First of all, will .x3d work in the browser without putting on .html file? Now I have such a code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Touchsensor in X3DOM</title>

    <link href="x3dom.css" rel="stylesheet" />
    <style>
    #myDiv {
        color: blue;
        margin: 20px 0;
    }
    x3d {
        display: block;
        width: 600px;
        height: 400px;
        background: #EEEEEE;
        border: none;
    }
    </style>
</head>
<body>


    <div id="myDiv">
        Click the sphere to hide this div
    </div>

    <x3d>
        <Scene>
            <Shape id="mySphere">
                <Appearance>
                    <Material diffuseColor="0 1 0" />
                </Appearance>
                <Sphere/>
            </Shape>
        </Scene>
    </x3d>


    <script src="x3dom.js"></script>
    <script>
    (function() {

        document.getElementById('mySphere').onclick = function(){
            document.getElementById('myDiv').style.display = "none";
// HERE I WANT TO PUT CALLS TO PHP OR HTML SCRIPT
// WILL IT WORK AT ALL? AJAX IS ON THE MIND
        };

    })();
    </script>


</body>
</html>

X3dom.js is what a file? How to load PHP file and where to get this .js? It's seems realizable - but can someone confirm?

0

There are 0 best solutions below