日期:2014-05-16  浏览次数:20407 次

问一个调用变量的问题
由于某些原因,我只能使用静态文件,但可以远程调用PHP文件。

现在来了个问题,我可以设置链接里加个链接

<a href = "view.html?id=2">链接2</a>

然后我可以找到代码,在view.html可以用JS获取ID的值

但我现在要调用一个JS

我怎么把值给传进来,只能用静态页面,比如JS等。来实现下面的效果?


<script src="http://www.163.com/view.php?id=2"> </script>

希望高手来解答?

本人白痴,希望示范代码可以写的完整些,让我方便用,不然我真的看不懂~~

谢谢各位高手了!!

------解决方案--------------------
恭喜楼主,不过不太明白楼主啥意思
------解决方案--------------------
尽量少用 document.write();

/ 动态导入js
function include(src,encoding,fun) 

var s = $C('script');
s.type='text/javascript';
s.charset=encoding; //'gb2312';
s.src = src;
var tags =$$('head');
if(typeof(fun)=='function'){
if( document.all ){
s.onreadystatechange = function(){
if(/(complete|loaded)/.test(this.readyState)){
fun(); s.onreadystatechange = null; s.parentNode.removeChild(s); 
}};
}else{
s.onload = function(){ fun(); s.onload = null; s.parentNode.removeChild(s); };
}

tags[0].appendChild(s); 
};

include("http://www.xxx.com/view.php?id=" + uid ,'utf-8');
------解决方案--------------------
view.html?id='""+id+'
超链接的页面
string id=request.queryString("id");
------解决方案--------------------
最好不要document.write

楼主搜下 js动态加载