Microsoft KB Archive/928708: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - ">" to ">")
 
Line 56: Line 56:
<li>On the '''File''' menu, point to '''New''', click '''page''' in the '''New''' task pane, click '''HTML''', and then click '''OK'''.</li>
<li>On the '''File''' menu, point to '''New''', click '''page''' in the '''New''' task pane, click '''HTML''', and then click '''OK'''.</li>
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li><p>Insert the following code sample between the <body&gt; and </body&gt; tags on your page.</p>
<li><p>Insert the following code sample between the <body> and </body> tags on your page.</p>
<pre class="codesample"><h3 align=&quot;center&quot;&gt;Where Do You Want to Go Today?</h3&gt;
<pre class="codesample"><h3 align=&quot;center&quot;>Where Do You Want to Go Today?</h3>
<center&gt;
<center>
<form&gt;
<form>
   <p&gt;<select name=&quot;section&quot; size=&quot;1&quot; language=&quot;javascript&quot; onChange=&quot;gotoPage(this.selectedIndex);&quot;&gt;
   <p><select name=&quot;section&quot; size=&quot;1&quot; language=&quot;javascript&quot; onChange=&quot;gotoPage(this.selectedIndex);&quot;>
   <option selected&gt;Where do you want to go today?</option&gt;
   <option selected>Where do you want to go today?</option>
   <option&gt;- - - - - - - - - - - - - - - - -</option&gt;
   <option>- - - - - - - - - - - - - - - - -</option>
   <option&gt;Microsoft Home Page</option&gt;
   <option>Microsoft Home Page</option>
   <option&gt;MSN Home Page</option&gt;
   <option>MSN Home Page</option>
   </select&gt;</p&gt;
   </select></p>
</form&gt;
</form>
</center&gt;
</center>
<script language=&quot;JavaScript&quot;&gt;
<script language=&quot;JavaScript&quot;>
<!--
<!--
function gotoPage(varItem)
function gotoPage(varItem)
Line 88: Line 88:
   }
   }
}
}
// --&gt;
// -->
</script&gt;</pre>
</script></pre>
<p>'''Note''' This code sample uses the '''window.location''' property to load new pages. If you are using a frameset, the new page is displayed in the current frame. If you want, you can use the '''window.open''' method to load the page and then specify a target frame. For example, to display the Microsoft home page in a full screen, use the following JScript code.</p>
<p>'''Note''' This code sample uses the '''window.location''' property to load new pages. If you are using a frameset, the new page is displayed in the current frame. If you want, you can use the '''window.open''' method to load the page and then specify a target frame. For example, to display the Microsoft home page in a full screen, use the following JScript code.</p>
<pre class="codesample">case 2:
<pre class="codesample">case 2:
       window.open(&quot;http://www.microsoft.com&quot;, target=&quot;_top&quot;);
       window.open(&quot;http://www.microsoft.com&quot;, target=&quot;_top&quot;);
       break;</pre>
       break;</pre>
<p>'''Note''' You may receive an error message, or the page may not display correctly if you copy the examples directly from this article, and then paste them to Expression Web. The angle brackets (<) and (&gt;) may appear as HTML code. To work around this behavior, first paste the code sample to a blank document in Notepad. Then, copy the code sample from the document in Notepad to your page in Expression Web. To do this, follow these steps:</p>
<p>'''Note''' You may receive an error message, or the page may not display correctly if you copy the examples directly from this article, and then paste them to Expression Web. The angle brackets (<) and (>) may appear as HTML code. To work around this behavior, first paste the code sample to a blank document in Notepad. Then, copy the code sample from the document in Notepad to your page in Expression Web. To do this, follow these steps:</p>
<ol style="list-style-type: lower-alpha;">
<ol style="list-style-type: lower-alpha;">
<li>Copy the code sample from step 4.</li>
<li>Copy the code sample from step 4.</li>
Line 101: Line 101:
<li>On the '''Edit''' menu, click '''Select All'''.</li>
<li>On the '''Edit''' menu, click '''Select All'''.</li>
<li>On the '''Edit''' menu, click '''Copy'''.</li>
<li>On the '''Edit''' menu, click '''Copy'''.</li>
<li>In Expression Web, position the cursor on a blank line immediately below the <body&gt; tag where you want to insert the JScript code.</li>
<li>In Expression Web, position the cursor on a blank line immediately below the <body> tag where you want to insert the JScript code.</li>
<li>On the '''Edit''' menu, click '''Paste'''.</li></ol>
<li>On the '''Edit''' menu, click '''Paste'''.</li></ol>
</li>
</li>
Line 121: Line 121:
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li><p>Position the cursor immediately after the following HTML code on your page, and then press ENTER to create a new line.</p>
<li><p>Position the cursor immediately after the following HTML code on your page, and then press ENTER to create a new line.</p>
<pre class="codesample"><option&gt;MSN Home Page</option&gt;</pre></li>
<pre class="codesample"><option>MSN Home Page</option></pre></li>
<li><p>On the new line, type the following HTML code to add this item to the list.</p>
<li><p>On the new line, type the following HTML code to add this item to the list.</p>
<pre class="codesample"><option&gt;Microsoft Help and Support Home Page</option&gt;</pre></li>
<pre class="codesample"><option>Microsoft Help and Support Home Page</option></pre></li>
<li><p>Position the cursor immediately after the following JScript code on your page, and then press ENTER to create a new line.</p>
<li><p>Position the cursor immediately after the following JScript code on your page, and then press ENTER to create a new line.</p>
<pre class="codesample">case 3:
<pre class="codesample">case 3:
Line 146: Line 146:
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li>On the '''View''' menu, point to '''Page''', and then click '''Code'''.</li>
<li><p>Locate the following code.</p>
<li><p>Locate the following code.</p>
<pre class="codesample"><option&gt;Microsoft Help and Support Home Page</option&gt;</pre></li>
<pre class="codesample"><option>Microsoft Help and Support Home Page</option></pre></li>
<li>Select the code that you located in step 3, right-click the code, and then click '''Delete'''.</li>
<li>Select the code that you located in step 3, right-click the code, and then click '''Delete'''.</li>
<li><p>Locate the following code.</p>
<li><p>Locate the following code.</p>

Latest revision as of 09:27, 21 July 2020

Article ID: 928708

Article Last Modified on 12/7/2006



APPLIES TO

  • Microsoft Expression Web



INTRODUCTION

This article describes how to create and modify a redirection drop-down list box in Microsoft Expression Web.

MORE INFORMATION

This article describes how to create and modify a drop-down list box control that uses JScript to open a specific URL.

Note This article uses custom JScript that may not be available in all Web browsers. For more information about browser compatibility, click Microsoft Expression Web Help on the Help menu, type browser compatibility in the Search for box, and then click Start searching to view the topics that are returned.

Create the redirection drop-down list box

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

  1. Start Expression Web, and then open your site.
  2. On the File menu, point to New, click page in the New task pane, click HTML, and then click OK.
  3. On the View menu, point to Page, and then click Code.
  4. Insert the following code sample between the <body> and </body> tags on your page.

    <h3 align="center">Where Do You Want to Go Today?</h3>
    <center>
    <form>
      <p><select name="section" size="1" language="javascript" onChange="gotoPage(this.selectedIndex);">
      <option selected>Where do you want to go today?</option>
      <option>- - - - - - - - - - - - - - - - -</option>
      <option>Microsoft Home Page</option>
      <option>MSN Home Page</option>
      </select></p>
    </form>
    </center>
    <script language="JavaScript">
    <!--
    function gotoPage(varItem)
    {
      switch(varItem)
      {
        case 0:
          window.parent.self.status="Goes Nowhere";
          break;
        case 1:
          window.parent.self.status="Goes Nowhere";
          break;
        case 2:
          window.location="http://www.microsoft.com";
          break;
        case 3:
          window.location="http://www.msn.com";
          break;
      }
    }
    // -->
    </script>

    Note This code sample uses the window.location property to load new pages. If you are using a frameset, the new page is displayed in the current frame. If you want, you can use the window.open method to load the page and then specify a target frame. For example, to display the Microsoft home page in a full screen, use the following JScript code.

    case 2:
          window.open("http://www.microsoft.com", target="_top");
          break;

    Note You may receive an error message, or the page may not display correctly if you copy the examples directly from this article, and then paste them to Expression Web. The angle brackets (<) and (>) may appear as HTML code. To work around this behavior, first paste the code sample to a blank document in Notepad. Then, copy the code sample from the document in Notepad to your page in Expression Web. To do this, follow these steps:

    1. Copy the code sample from step 4.
    2. Start Notepad, and then open a blank document.
    3. On the Edit menu, click Paste.
    4. On the Edit menu, click Select All.
    5. On the Edit menu, click Copy.
    6. In Expression Web, position the cursor on a blank line immediately below the <body> tag where you want to insert the JScript code.
    7. On the Edit menu, click Paste.
  5. On the File menu, click Save.
  6. In the Save As dialog box, specify a file name and a location where you want to save the page, and then click Save.
  7. On the File menu, point to Preview in Browser, and then click the browser that you want to use to preview the page.

Add a URL to the redirection drop-down list box

To add a URL to the list that is displayed in the drop-down list box, you must perform the following actions:

  • Add an entry to the option list in the HTML code.
  • Add an entry to the "switch(varItem)" section in the JScript code.

For example, to add a list item for the Microsoft Help and Support Web site, follow these steps.

Note These steps assume that you did not make any changes to the code sample after you pasted it to Expression Web.

  1. Start Expression Web, and then open the page that contains the drop-down list box.
  2. On the View menu, point to Page, and then click Code.
  3. Position the cursor immediately after the following HTML code on your page, and then press ENTER to create a new line.

    <option>MSN Home Page</option>
  4. On the new line, type the following HTML code to add this item to the list.

    <option>Microsoft Help and Support Home Page</option>
  5. Position the cursor immediately after the following JScript code on your page, and then press ENTER to create a new line.

    case 3:
          window.location="http://www.msn.com";
          break;
  6. On the new line, type the following JScript code to redirect the URL to the Web site that you are adding.

    case 4:
          window.location="http://support.microsoft.com";
          break;     
  7. On the File menu, click Save.
  8. On the File menu, point to Preview in Browser, and then click the browser that you want to use to preview the page.

Remove a URL from the drop-down list box

To remove a URL from the list that is displayed in the drop-down list box, you must perform the following actions:

  • Remove the entry from the option list in the HTML code.
  • Remove the entry from the "switch(varItem)" section in the JScript code.

For example, to remove the list item for the Microsoft Help and Support Web site, follow these steps:

  1. Start Expression Web, and then open the page that contains the drop-down list box.
  2. On the View menu, point to Page, and then click Code.
  3. Locate the following code.

    <option>Microsoft Help and Support Home Page</option>
  4. Select the code that you located in step 3, right-click the code, and then click Delete.
  5. Locate the following code.

    case 4:
          window.location="http://support.microsoft.com";
          break;
  6. Select the code that you located in step 5, right-click the code, and then click Delete.
  7. On the File menu, click Save.
  8. On the File menu, point to Preview in Browser, and then click the browser that you want to use to preview the page.


Keywords: kbhowto kbprb kbexpertiseinter KB928708