给js文件传入参数

来源:互联网 发布:2015进出口数据 编辑:程序博客网 时间:2024/04/27 14:49

在网上搜了一下,感觉有个方法很好


<head>

<script id="news_head_js" type="text/javascript" src="/pf/common/js/news/news_head.js" param="${connProperties.fileServer}"></script>

</head>


in the file news_head.js, we can use this code to get the parameter

var scriptParam = document.getElementById('news_head_js').getAttribute('param');