Javascript IFrame未在HREF更改中导航

时间:2012-08-01 20:06:00

标签: javascript jquery html

<frameset rows="250px,*" onload="start_here();">
    <frame src="leftframe.htm" name="topo" id="topo" application="yes" />
    <frame src="leftframe.htm" name="link" id="link" />
</frameset>

这是我的Javascript代码

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script language="text/javascript">
function start_here()
{
        var usernameFromCookie = GetCookie(site);
        var urlToSite = createCustomURL(usernameFromCookie);
        alert(urlToSite);
}
function createCustomURL(userName)
{
        var customURL = "http://server1/get/cgi-app.exe?HOSTID=AD&ALIAS=" + userName;
        return customURL;
}
function setUserLink(urlFromCookie)
{
        $('a#link').attr('href', urlFromCookie);
}

我正在尝试将第二帧(名称是链接)重定向到网站

1 个答案:

答案 0 :(得分:2)

我认为你正在设置框架src。

$('#link').attr('src', urlFromCookie);