开发者

Retrieve a URL of a frame

开发者 https://www.devze.com 2022-12-31 04:47 出处:网络
If I get a link <a href=\"/Users/ChangePassword.aspx\" target=\"mainFrame\"> in fraTopMenu, what

If I get a link

<a href="/Users/ChangePassword.aspx" target="mainFrame"> in fraTopMenu, what (1) javascript can I add to get the current mainFrame's URL upon clicking the link and (2) append the URL to the querystrings?

<frameset rows="60,*" cols="*" frameborder="no" border="0" framespacing="0">
      <frame src="/Common/Manager/TopMenu.aspx"  name="fraTopMenu" scrolling="no" noresize="noresize" id="fraTopMenu" t开发者_运维技巧itle="" />
      <frameset rows="*" cols="185,*" framespacing="0" frameborder="no" border="0">
        <frame src="..." name="leftFrame" id="leftFrame" title="" />
        <frame src="..." name="mainFrame" id="mainFrame" title="" />
      </frameset>
    </frameset>

Thank you.


  1. Don't use frames.
  2. Don't use frames.
  3. document.getElementById('mainFrame').location


You can access the frames location by using

alert(window.frames["mainFrame"].contentWindow.location.href);

But you should avoid frameset and frame as these are deprecated in XHTML and in HTML5.

0

精彩评论

暂无评论...
验证码 换一张
取 消