HOw do i link to a local file in Front page

N

New Front Pager

I am trying to use a switch structure to jump to different pages on my web
site. I have tried the following code segment. Case 2 works fine, but case 3
presents a blank screen. Do I have something wrong in the syntax?
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="Test button.htm";
break;
}
}
 
J

Jens Peter Karlsen [FP-MVP]

Remove the space from the filename.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.

On Wed, 10 Aug 2005 19:45:02 -0700, New Front Pager <New Front
 
N

New Front Pager

Thanks for the help. I removed the space as you suggested. When I go to
preview screen and select the line for case 3 nothing happens. I get no error
messages and no response. The main window is cleared but the new window does
not appear.
If I select case 3 it jumps to the microsoft web site as expected.
Is the line:
window.location="Test button.htm";
correct syntax for a local htm file in the same directory as the main page?
New code segment is:

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<h3 align="center">Main Menu</h3>
<center>
<form>
<p><a href="new_page_2.htm">
<select name="section" size="1" language="javascript"
onChange="gotoPage(this.selectedIndex);">
<option selected>Select product catagory</option>
<option>- - - - - - - - - - - - - - - - -</option>
<option>Testbutton</option>
<option>Microsoft Home Page</option>
</select></a></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="Testbutton.htm";
break;
case 3:
window.location="http://www.microsoft.com/";
break;
}
}
// -->
</script>
<p></p>
<p> </p>
</body>
</html>
 
J

Jens Peter Karlsen [FP-MVP]

Did you remember to rename the actual file as well?

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
R

Ronx

You have a hyperlink wrapped around the select box.
Code should be:

<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<h3 align="center">Main Menu</h3>
<center>
<form>
<select name="section" size="1"
onChange="gotoPage(this.selectedIndex);">
<option selected>Select product catagory</option>
<option>- - - - - - - - - - - - - - - - -</option>
<option>Testbutton</option>
<option>Microsoft Home Page</option>
</select>
</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="Testbutton.htm";
break;
case 3:
window.location="http://www.microsoft.com/";
break;
}
}
// -->
</script>
<p></p>
<p> </p>
</body>
</html>
 
N

New Front Pager

Yes the file name matches the reference. When you look at a map of the hyper
links it shows a link from the menu to the button page. Everything seems to
be ok. I get no errors when I preview the main menu and select the
testbutton, all that comes up is a blank page instead of the real page. THis
is a mystery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top