x3d简单示例在使用AJAX和PHP的Win 10中有效,但添加警报后

问题描述

我终于可以使用X3D站点中的场景制作3D示例。 JS,PHP,AJAX的含义。 数据从PHP脚本加载,并使用AJAX调用。 X3D场景中有3个对象。 但是,在添加警报消息进行测试或尝试更改div的innerHTML之后,警报未显示

这是一个基本示例。为什么这样不起作用?我们是否必须以某种方式从AJAX中删除脚本?

<html>
<head>
    <Meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>My first x3dom page</title>
    <script type='text/javascript' src='https://www.x3dom.org/download/x3dom.js'> </script>
    <link rel='stylesheet' type='text/css' href='https://www.x3dom.org/download/x3dom.css'>
    <script>
        function changeColor()
        {
            if(document.getElementById("color").getAttribute('diffuseColor')=="1 0 0")
                document.getElementById("color").setAttribute('diffuseColor','0 0 1');
            else
                document.getElementById("color").setAttribute('diffuseColor','1 0 0');
        }
    </script>
    <style>
        x3d
        {
            border:2px solid darkorange;
            background: rgba(128,128,0.4);
        }

        body
        {
            font-size:110%;
            font-family:verdana,sans-serif;
            background-image: url('pattern.png');
            margin: 3em;
            color: lightgray;
        }

        h1
        {
            color: darkorange;
        }
    </style>
</head>
<body>

<h1>Hello,x3dom!</h1>
<p>
    This is my first html page with some 3d objects.
</p>
<x3d width='500px' height='400px'>
    <scene>
        <shape onclick="changeColor();">
            <appearance>
                <material id ="color" diffuseColor='1 0 0'></material>
            </appearance>
            <Box></Box>
        </shape>
        <transform translation='-3 0 0'>
            <shape>
                <appearance>
                    <material diffuseColor='0 1 0'></material>
                </appearance>
                <cone></cone>
            </shape>
        </transform>
        <transform translation='3 0 0'>
            <shape>
                <appearance>
                    <material diffuseColor='0 0 1'></material>
                </appearance>
                <sphere></sphere>
            </shape>
        </transform>
    </scene>
</x3d>
<div id="digital_download">
A
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script>
$('#digital_download').html('Downloading...'); // Show "Downloading..."
// Do an ajax request
$('#digital_download').load('http://localhost/index2.PHP');
alert("YES");
if (document.getElementById('digital_download').innerHTML=="Hello!") alert("yes");

</script>


</body>
</html> 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)