Framed Menu Select List

[Total: 0    Average: 0/5]

Use frames to view web pages by use of select list choices.

Head Code:

<script language="JavaScript">
<!--
var results = 
      "<html><body><font size=+1>" +
      "Please select " +
      "a web site and page on that web site.<br>" +
      "Press the " +
      "<b>Connect</b> button when finished." +
      "</font></body></html>";
function chooseServer() {
  var botFrame=parent.frames['bot'];
  var idxs=parent.frames[0].document.forms[0].ns.selectedIndex;
  var idxg=parent.frames[0].document.forms[0].ng.selectedIndex;
  var nServ =
      parent.frames[0].document.forms[0].ns.options[idxs].text;
  var nGroup =
      parent.frames[0].document.forms[0].ng.options[idxg].text;
  var newsUrl = "http://" + nServ + "/" + nGroup;

  if (confirm("Shall I connect to: " + newsUrl)) {
     // Load --> news://servername/groupname
     parent.frames[1].location = newsUrl;
  }
}

function buttons() {
  var but = "<html><body>" +
            "<form name='f1'>" +
            "<input type='button' value='Connect'" +
            "onClick='parent.chooseServer()'>&nbsp;" +
            "<select name='ns'>" +
            "<option selected>www.js-examples.com" +
            "<option>www.js-examples.com" +
            "<option>www.js-examples.com" +
            "</select>&nbsp;" +
            "<select name='ng'>" +
            "<option selected>js" +
            "<option>consult" +
            "<option>sporum" +
            "</select>" +
            "</form>" +
            "</body></html>";
  return(but);
 }
//-->
</script>

Body Code:

<frameset rows="12%,88%">
<frame name="top"
       src="javascript:parent.buttons()"
       scrolling="no">
<frame name="bot"
       src="javascript:parent.results"
       scrolling="yes">
</frameset>

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *