开发者

Targeting frames from within a frameset

开发者 https://www.devze.com 2023-02-06 22:15 出处:网络
I have the following frame stru开发者_JS百科cture: <FRAMESET rows=\"25%,75%\"> <FRAME SRC=\"Banner.htm\" BORDERCOLOR =\"red\" NORESIZE=\"NORESIZE\"/>

I have the following frame stru开发者_JS百科cture:

<FRAMESET rows="25%,75%">
  <FRAME SRC="Banner.htm" BORDERCOLOR ="red" NORESIZE="NORESIZE"/>
    <FRAMESET cols="25%,75%">
      <FRAME NAME="list" SRC="PackageList.htm" BORDERCOLOR="red" NORESIZE="NORESIZE"/>
      <FRAME ID="details" BORDERCOLOR="red" NORESIZE="NORESIZE"/>
    </FRAMESET>
</FRAMESET>

I have an HTML page named kolkata_culture.htm and also have a tag whose ID is culture in the frame named list.

Now I want to load the page kolkata_culture.htm into the frame having ID details

in response to the event of clicking the tag whose ID is culture from the frame named list and load that frame into the frameset.

How can I do the job through vbscript?


You probably would want to use JavaScript for this, because it works in all browsers (vbscript works only in IE).

You can load frames dynamically from JavaScript (in this example, the frame with the ID "details" will be pointed to a new url):

</FRAMESET>
<script type="javascript">
    // load new page into frame (careful; the attribute name is case sensitive)
    document.getElementById("details").setAttribute("SRC", "http://example.com/");
</script>

Or from an html event handler:

<input type="button" onclick="document.getElementById("details").setAttribute("SRC", "http://google.com/");" >Click me!</button>
  • Replace «details» with your frame id
  • make sure the attribute name is correct (attribute names are case sensitive)
  • replace «http://google.com/» with your target url
  • replace «Click me!» with your button label


<frame name="framename1" src="local.htm" scrolling="no" noresize="noresize" >
<frame name="framename2" src="./http://www.google.com" scrolling="YES" noresize="noresize">

0

精彩评论

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