pre-loading select menu not working with database

C

Chuck

I'm having trouble making a bit of Javascript work. I
have a form that preselects the user's previous selection
on return to the ASP page, but it only works as long as
no database is involved. Works great posting to "Other"
or "ASP" but as soon as the post is to a database the
code stops working. Here's the code:
****************

<%itemToSelect = Session("item1")%>

<script type "text/Javascript"><!--
function PreselectMyItem(itemToSelect)
{
var myDropDownList = document.forms(0).Center;
for (i = 0; i < myDropDownList.options.length;
i++)
{
if(myDropDownList.options.value ==
itemToSelect)
{
myDropDownList.options.selected = true;
break;
}
}
}
--></script>

</head>

<body onload="PreselectMyItem('<%=itemToSelect%>')">
******************
The form posts to a FP-generated database.

Any direction would be greatly appreciated!
Thanks.
Chuck
 
C

Chuck

Sorry about the dup post- I actually canceled the first
post when I saw a mis-spelling after hitting "send", but
it went anyway without giving me an indication that it
went.

Chuck
-----Original Message-----
Hi Chuck,

See my response to your first post in this NG.


--
Mike -- FrontPage MVP '97-'02
J-Bots 2004 Released Special Pricing
http://www.websunlimited.com
FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000 Compatible

"Chuck" <[email protected]> wrote in
message news:[email protected]...
I'm having trouble making a bit of Javascript work. I
have a form that preselects the user's previous selection
on return to the ASP page, but it only works as long as
no database is involved. Works great posting to "Other"
or "ASP" but as soon as the post is to a database the
code stops working. Here's the code:
****************

<%itemToSelect = Session("item1")%>

<script type "text/Javascript"><!--
function PreselectMyItem(itemToSelect)
{
var myDropDownList = document.forms(0).Center;
for (i = 0; i < myDropDownList.options.length;
i++)
{
if(myDropDownList.options.value ==
itemToSelect)
{
myDropDownList.options.selected = true;
break;
}
}
}
--></script>

</head>

<body onload="PreselectMyItem('<%=itemToSelect%>')">
******************
The form posts to a FP-generated database.

Any direction would be greatly appreciated!
Thanks.
Chuck



.
 
T

Tom Pepper Willett

Posts are not cancellable on MS servers.
--
===
Tom "Pepper" Willett
Microsoft MVP - FrontPage
---
About FrontPage 2003:
http://office.microsoft.com/home/office.aspx?assetid=FX01085802
FrontPage 2003 Product Information:
http://www.microsoft.com/office/frontpage/prodinfo/default.mspx
Understanding FrontPage:
http://msdn.microsoft.com/office/understanding/frontpage/
FrontPage 2002 Server Extensions Support Center:
http://support.microsoft.com/default.aspx?scid=fh;en-us;fp10se
===
| Sorry about the dup post- I actually canceled the first
| post when I saw a mis-spelling after hitting "send", but
| it went anyway without giving me an indication that it
| went.
|
| Chuck
|
| >-----Original Message-----
| >Hi Chuck,
| >
| >See my response to your first post in this NG.
| >
| >
| >--
| >Mike -- FrontPage MVP '97-'02
| >J-Bots 2004 Released Special Pricing
| >http://www.websunlimited.com
| >FrontPage Add-ins Since '97 FP 2003 / 2002 / 2000
| Compatible
| >
| message | >> I'm having trouble making a bit of Javascript work. I
| >> have a form that preselects the user's previous
| selection
| >> on return to the ASP page, but it only works as long as
| >> no database is involved. Works great posting
| to "Other"
| >> or "ASP" but as soon as the post is to a database the
| >> code stops working. Here's the code:
| >> ****************
| >>
| >> <%itemToSelect = Session("item1")%>
| >>
| >> <script type "text/Javascript"><!--
| >> function PreselectMyItem(itemToSelect)
| >> {
| >> var myDropDownList = document.forms(0).Center;
| >> for (i = 0; i < myDropDownList.options.length;
| >> i++)
| >> {
| >> if(myDropDownList.options.value ==
| >> itemToSelect)
| >> {
| >> myDropDownList.options.selected = true;
| >> break;
| >> }
| >> }
| >> }
| >> --></script>
| >>
| >> </head>
| >>
| >> <body onload="PreselectMyItem('<%=itemToSelect%>')">
| >> ******************
| >> The form posts to a FP-generated database.
| >>
| >> Any direction would be greatly appreciated!
| >> Thanks.
| >> Chuck
| >
| >
| >.
| >
 

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