在函数里面声明参数是合法吗??例如:var the_window.src = the_name;(事实是不可以的!但我还是想问问清楚!)<script type="text/javascript">
function Jpg_Image(the_url,the_window,the_name)
{
var the_window = window.open(the_url,'','');
var the_window.src = the_name;
}
</script>
function Jpg_Image(the_url,the_window,the_name)
{
var the_window = window.open(the_url,'','');
var the_window.src = the_name;
}
</script>
var the_window.src = the_name; //这行代码报错的原因是你写的变量名是非法的,变量名不能含有点号
如果你是想修改新打开的窗口的url,那就不应该用var,因为你上面已经声明了一个the_window变量,保存的是对新打开的窗口对象的引用,但是window对象并没有src属性,修改window对象的url要这么写:
the_window.location.href = the_name;
<script type="text/javascript">
function Jpg_Image(the_url,the_window_name,new_image)
{
var the_window = window.open(the_url,'','');
var the_window_name.src = new_image;
}
</script>我想请教下.........变量the_window_name是Jpg_Image函数的参数。如果我在函数中声明自己函数的参数是否合法??就像上面代码写道【var the_window_name.src = new_image;】。
<script type="text/javascript">
function Jpg_Image(the_url,the_window_name,new_image)
{
var the_window = window.open(the_url,'','');
var the_window_name.src = new_image;
}
</script>
我想请教下.........变量the_window_name是Jpg_Image函数的参数。如果我在函数中声明自己函数的参数是否合法??就像上面代码写道【var the_window_name.src = new_image;】。