现在的位置: 首页 > 综合 > 正文

给js文件传入参数

2013年09月07日 ⁄ 综合 ⁄ 共 291字 ⁄ 字号 评论关闭

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

<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');

抱歉!评论已关闭.