最近正在做一个普通的门户网站,里面有个新闻flash展示,flash我是从网上down的,通过JavaScript脚本传的文本、图片、链接参数。但是现在遇到一个问题,就是链接的参数JavaScript脚本没有完全识别,其中一个链接是这样的,endnews.aspx?id=3&fid=2&sid=9,但是我在页面中点击过去之后,发现地址是endnews.aspx?id=3,也就是“&”之后的都断开了。而且这个flash展示是4个图片切换的,只有第一个好使,后面的切换不过去,请教达人解决方案,谢谢!
后台:
for (int index = 0; index < rowCount; index++)
{
if (plist[index].Title.Length > 16)
{
tmp_text = plist[index].Title.Substring(0, 15) + "...";
}
else
{
tmp_text = plist[index].Title;
}
if (index == rowCount - 1)
{
flash_pic += "admin\\" + plist[index].Picaddress;
flash_link += "endnews.aspx?id=" + plist[index].ID + "&fid=2&sid=9";
flash_text += tmp_text;
}
else
{
flash_pic += "admin\\" + plist[index].Picaddress + "|";
flash_link += "endnews.aspx?id=" + plist[index].ID + "&fid=2&sid=9" + "|";
flash_text += tmp_text + "|"; }
}
this.pic1.Value = flash_pic;
this.link1.Value = flash_link;
this.text1.Value = flash_text;前台:_________________________________________________
<input type="hidden" id="pic1" runat="server" />
<input type="hidden" id="link1" runat="server" />
<input type="hidden" id="text1" runat="server" />
<script type="text/javascript">
var _width = 260
var _height = 190
var text_height = 20
var flash_height = _height + text_heightvar p = document.getElementById('pic1').value;
var l = document.getElementById('link1').value;
var t = document.getElementById('text1').value;var f = "images/focus.swf";
document.write('<object ID="focus_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ _width +'" height="'+ flash_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+f+'"><param name="quality" value="high"><param name="bgcolor">');
document.write('<param name="menu" value="false"><param name=wmode value="transparent">');
document.write('<param name="FlashVars" value="pics='+p+'&links='+l+'&texts='+t+'&borderwidth='+_width+'&borderheight='+_height+'&textheight='+text_height+'">');
document.write('<embed ID="focus_flash" src="'+f+'" wmode="opaque" FlashVars="pics='+p+'&links='+l+'&texts='+t+'&borderwidth='+_width+'&borderheight='+_height+'&textheight='+text_height+'" menu="false" quality="high" width="'+ _width +'" height="'+ flash_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
</script>
你可以试试用"%26" 替换"&" 看看