0

看看下面的小代码块

<html>
<head>
<script type="text/javascript" src="http://mydomain.com/jquery-min.js"></script>
<script id="the-script" type="text/javascript" src="http://otherdomain.com/js/some-script.js"></script>
<script>
   /*
     console.log(jQuery("#the-script").some-property);
   */
</script>
</head>
<body>
</body>
</html>

jQuery("#the-script").some-property要求一些属性,允许我将脚本的源代码作为文本(字符串)获取。有没有用于此目的的财产?

4

1 回答 1

0

You can send ajax request for the content of that file and do whatever with it. I made a fiddle where I loaded jQuery source code into span element to show you how this can work.

http://jsfiddle.net/Z7X6Z/

于 2013-06-05T20:50:08.143 回答