Demo entry 6687166

和规范

   

Submitted by sunxubo on Dec 26, 2017 at 10:21
Language: HTML. Code size: 818 Bytes.

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	
</head>
<body>
	<!-- <iframe src="demo.svg" frameborder="0"></iframe> -->
	<!-- <object data="demo.svg" type=""></object> -->
	<!-- <embed src="demo.svg" type=""> -->
  <svg data-src="demo.svg"></svg>
  <script src="jquery.js"></script>
  <script>
    window.addEventListener('load', function() {
      var svgs = document.getElementsByTagName('svg');
      for (var i = 0; i < svgs.length; i++) {
        // ???
        // console.log(svgs[i].dataset);
        var src = $(svgs[i]).data('src');
        // 向服务器发送请求 得到svg
        $.get(src, function(data) {

          var el = data.documentElement;
          $(document.body).append($(el));
        });
      }
    });
  </script>
</body>
</html>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).