RE: on/off option
- From: "GGill" <GGill@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 Dec 2005 17:11:02 -0800
In asp file i added HTML Form using radio buttons and created new table - tbl
Switch and field name 'switch' in SQL Database. Here is what i have, please
could you point where should i enter the ASP code;
----------------------------------------------
<%@ LANGUAGE="VBScript" %>
<%
' ---------- init --------
tablename = "tblSwitch"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open connectadminstring
%>
<h1>Switch On/Off</h1>
<FORM METHOD="POST">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" align="left">
<TR>
<TD>Switch On<% Call RadioButton("switch", "on", Request) %></TD></TR>
<TR>
<TD>TSwitch Off<% Call RadioButton("switch", "off", Request) %></TD></TR>
<TR><TD><INPUT NAME="action" TYPE="SUBMIT" VALUE="Update"></TD></TR>
</Table>
</FORM>
</BODY>
</HTML>
-----------------------------------------------
"GGill" wrote:
> Thank you Jim,
> I am going to try and let you know how that works.
>
> "Jim Buyens" wrote:
>
> > On the page where you contol the action, I would add an HTML form with a
> > checkbox named chkYahoo and a submit button named btnSub. Then, I would add
> > this ASP code:
> >
> > If ("" & Request.Form("btnSub") <> "") Then
> > If ("" & Request.Form("chkYahoo ") = "ON") Then
> > Session("BlockYahoo") = "Y"
> > Else
> > Session("BlockYahoo") = "N"
> > End if
> > End If
> >
> > In the page Visitors would see, I would then code:
> >
> > Response.Write "<a href="""
> > If ("" & Session("BlockYahoo") = "Y") Then
> > Response.Write "javascript:window.alert" & _
> > "('Link yahoo unavailable for this moment');"
> > Else
> > Response.Write "http://www.yahoo.com"
> > End If
> > Response.Write """>Yahoo</a>"
> >
> > Note, however, that this still doesn't block people who might have
> > bookmarked "http://www.yahoo.com". To do that, you'd have to add some code
> > like the following to the target page (which I suspect really isn't Yahoo).
> >
> > <body>
> > <%
> > If ("" & Session("BlockYahoo") = "Y") Then
> > Response.Write "<p>'Link yahoo unavailable for this moment'</p>" & vbCrLf
> > Response.End
> > End If
> >
> > And of course, if you wanted this block to remain in place for a long time
> > -- so long that you have to persist it across reboots -- then yes, you'd
> > probably have to store the allowed/disallowed switch in a database or file
> > rather than a Session variable.
> >
> > Jim Buyens
> > Microsoft MVP
> > http://www.interlacken.com
> > Author of:
> > o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
> > Now!
> > o--> Microsoft Office FrontPage 2003 Inside Out
> > o--> Microsoft Windows SharePoint Services Inside Out
> > o--> Faster Smarter Beginning Programming
> >
> >
> >
> > "GGill" wrote:
> >
> > > It's ASP pages.
> > > I want to enable and disable link until i will chande switch button.
> > > For example I have web page on the page I have two links, one link is yahoo
> > > it will open yahoo.com site. The second link name SwitchOn/Off it will open
> > > page where I should have two radio buttons, 1 radio button – ‘Switch On’, 2
> > > radio button – ‘Switch Off’. So if you select ‘Switch Off’ then on the first
> > > page link yahoo should not be open, if you click on link should show msgbox
> > > “Link yahoo unavailable for this moment”, and then if you click on ‘Switch
> > > On’ then you should able too open link yahoo. Do I need to create new table
> > > in sql server to able to update switch button? Is a better use drop down list
> > > on and off? Please help me.
> > >
> > >
> > > "Jim Buyens" wrote:
> > >
> > > > There are too many ways of doing this, each with its own advantages and
> > > > drawbacks, to recommend one of them based on the information you've given.
> > > >
> > > > What are these pages?
> > > > Why do you want to enable and disable access?
> > > > For how long do you want to enable and disable access?
> > > > What kind of action do you want to take to enable and disable access?
> > > >
> > > > Jim Buyens
> > > > Microsoft MVP
> > > > http://www.interlacken.com
> > > > Author of:
> > > > o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
> > > > Now!
> > > > o--> Microsoft Office FrontPage 2003 Inside Out
> > > > o--> Microsoft Windows SharePoint Services Inside Out
> > > > o--> Faster Smarter Beginning Programming
> > > >
> > > > "GGill" wrote:
> > > >
> > > > > My web page has two links, which is Link1 will open some page and Link2
> > > > > open page where I should have switch option ON/OFF, if it is OFF then when
> > > > > you click on Link1 you should not able to open page, just msgbox ‘It is not
> > > > > available for this moment’, and if it is ON then you will able to open link1.
> > > > > Please help me to create this on/of option.
> > > > >
.
- Follow-Ups:
- RE: on/off option
- From: Jim Buyens
- RE: on/off option
- References:
- RE: on/off option
- From: Jim Buyens
- RE: on/off option
- From: GGill
- RE: on/off option
- Prev by Date: Re: Heavy code
- Next by Date: RE: on/off option
- Previous by thread: RE: on/off option
- Next by thread: RE: on/off option
- Index(es):