日期:2014-05-18  浏览次数:20461 次

服务器端 如何操作指定IFRAME的SRC指向?在线等待!
HTML:
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body   bottommargin= "0 "   leftmargin= "0 "   rightmargin= "0 "   topmargin= "0 ">
        <form   id= "form1 "   runat= "server ">
          <iframe     id= "top "   src= "../Top.aspx "   height= "90 "   scrolling= "no "   width= "100% "> </iframe>
          <iframe     id= "mainFrame "       height= "450 "   scrolling= "auto "   width= "100% "> </iframe>
        </form>
</body>
</html>

CS:
    服务器端组合出如下的URL,ConfigurationManager.AppSettings[ "urlDirectory "]   +   this.Request.QueryString[ "url "].ToString()   。想控制 <iframe     id= "mainFrame "转到上面组合出的URL,该如何实现?

------解决方案--------------------
1.可以加个runat= "server " 然后 this.top.Attibute[ "src "] = "... " 或 <iframe id= "top " src= ' <%=变量%> '
------解决方案--------------------
例子: IFRAME1.Attributes.Add( "src ", "RateDistribute.aspx?ServiceRateID= " + nRetID + " ");