javascript - Change the x3dom model with a button click -
i have 2 x3d files namely 1.x3d
, 12.x3d
, want use button load them onto canvas code doesn't seem work . see loading icon in top left model doesn't change .
here code : -
<!doctype html> <html> <head> <meta http-equiv='content-type' content='text/html;charset=utf-8'></meta> <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link> <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("x3d > scene > inline").attr("url", "1.x3d"); }); }); </script> </head> <body> <button> click change background </button> <x3d id='someuniqueid' showstat='false' showlog='false' x='0px' y='0px' width='400px' height='400px'> <scene> <inline id="myinline" url='12.x3d' ></inline> <scene> </x3d> </body> </html>
i tested , works should, can't test local.
xmlhttprequest cannot load file:///c:/users/xxx/desktop/12.x3d. cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Comments
Post a Comment