سؤال

أنا ألعب مع VRML في الوقت الحالي، وليس من خلال الاختيار أن أكون صادقا ولكن لمشروع على الويب ثلاثي الأبعاد.

أحاول إنشاء جهاز استشعار تعمل باللمس في VRML التي ستعرض وإخفاء DIV في صفحة ويب.لقد حاولت كتابة نص WEE باستخدام

Browser.LoadUrl ('JavaScript: منصفة ()')؛

لمحاولة اختبار هذا.

لا يتم استدعاء JavaScript أبدا، ومع ذلك، فأنا أعرف جهاز استشعار اللمس الخاص بي على ما يرام كوظائف معينة حاولت استخدامها (على سبيل المثال، إذا قمت بإهاء خطأ "المتصفح")، فهذا يحدث خطأ.

ربما هذا ليس فقط غير مدعوم من المتصفحات الحديثة؟

أي مساعدة والمشورة موضع تقدير كبير. giveacodicetagpre.

هل كانت مفيدة؟

المحلول

Do they only want classic VRML or is X3D allowed ? (X3D is the name of the current version of VRML).

If you are allowed to use X3D (I don't see why not), you could use X3DOM which is a WebGL engine, you may even get extra points on your assignment :)


Here's an example that hides a div when you click on a 3D sphere:

<!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";
        };

    })();
    </script>


</body>
</html>

And by the way, X3D is the recommended 3D technology by the HTML5 spec, it isn't dead at all :-)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top