1
가능한 중복 :
How can I get the content of the file specified as the ‘src’ of a <script> tag?스크립트를 코드로 추가하려면 어떻게합니까?
나는 그것이 실행됩니다 방지, 스크립트 내 "정의"를 인쇄 할.
함께 시도 :var scriptWidget = document.createElement('script');
scriptWidget.type = 'text/javascript';
scriptWidget.src = "http://www.mywebsite.it/file.js";
$('#widget-html-codici').html(escape(scriptWidget));
하지만 %5Bobject%20HTMLScriptElement%5D
를 인쇄합니다. 코드를 "코드"로 인쇄하려면 어떻게해야합니까?
var script = '<script type="text/javascript" ' // pay attention to
+ 'src="http://www.mywebsite.it/file.js"></' // splitting of '</'
+ 'script>'; // and 'script>'
$('#widget-html-codici').text(script);
DEMO :http://jsfiddle.net/NPBJm/
그것은 텍스트로 인쇄되지 않습니다. .. 항상 스크립트로하지만 다른 유형으로. .. – markzzz
'file.js'의 소스 코드를 출력하거나 실제 스크립트 태그'
당신은 할 수 있습니다 : 당신은 단순히 다음 사용하면 어떻게
출처
2012-11-20 13:41:11
'alert'와'console.log'는 값을 마크 업으로 푸시하는 것과 같지 않습니다 : http://jsfiddle.net/qebCy/1/. – VisioN