如何解决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 举报,一经查实,本站将立刻删除。