simply the dumbest question today I bet...on click open in a speicifc frame

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Okay, I know nothing and I admit it. I have a simple form with a set
of buttons at the top and depending on the button you push, displays
some data at the button of the form. This is probably to much info,
but the sub actually gets the data from a SQL server and then
dynamically builds the table to display at the bottom of the page.

I would like to divide this single page into two pages so that I can
have all the buttons in one frame and the results in another do I do this? Heres an example of my html (just one button
shown here):

<Script Language="VBScript">

Sub btnListBackups_OnClick()
 Set oConnection = CreateObject("ADODB.Connection")
 oConnection.Open "Provider=SQLOLEDB" & _
  ";Data Source=" & "DBDELTA1" & _
  ";Integrated Security=SSPI"
 Set recordSet = oConnection.Execute("EXEC tempdb..sp_lastback")
 myResultTable = "<table border=""1"">"
 myResultTable = myResultTable & "<tr>"
 For i = 0 To recordSet.Fields.Count - 1
  myResultTable = myResultTable & _
   "<th>" & _
   recordSet.Fields(i).Name & _
 myResultTable = myResultTable & "</tr>"
 Do While Not recordSet.EOF
  myResultTable = myResultTable & "<tr>"
  For i = 0 To recordSet.Fields.Count - 1
   myResultTable =  myResultTable & _
    "<td>" & _
    recordSet.Fields(i).Value & _
  myResultTable = myResultTable & "</tr>"
 myResultTable = myResultTable & "</table>"

 Results.innerHTML = myResultTable
End Sub

<input type="button" id="btnListBackups" value="List Backups">
<nobr Id=Results></nobr>

Re: simply the dumbest question today I bet...on click open in a speicifc frame

On 18 Oct 2004 12:00:42 -0700, (sumGirl) wrote:

>Okay, I know nothing and I admit it.

Here's one fact - go off and have a play with it, see where you get

"Scripting" comes in two flavours, server-side and client-side.

Server-side scripting runs on the server. Code runs, the page gets
sent. Then it stops running - it can't change the page or respond to
anything that happens from users clicking on it.  Running on the
server is a good place to connect to databases.

Client-side scripting runs on the web browser. It's good at responding
to user clicks, poor at generating pages and pretty much impossible to
connect to databases from.

So your example needs to run on the server.  By the looks of the
example you've pretty much coded this, and you've coded it in ASP
(which might even work).  Then you've wrapped it in <script> rather <%
.... %>  so that it's seen as client-side code.  It's good code, but in
the wrong place.

Change it to be server-side code.  Use the <%...%> syntax. Using
"runat='server'" is often confusing (although it would work).

Suggestion:  Ditch VBScript - JScript is a much better language.

Now you have one problem left, how to do the "two views".  Forget this
for the moment, get it working first with just one.

Then write it so that a different result is returned depending on the
URL supplied - look at how to read parameters from the query string.
Give it sensible default action if the parameter is missing.

To permit switching between the two views, then it's impractical to do
this client-side. Instead resubmit the page request and generate it
again.  Place the button(s) on the page inside a form, coded so that
it's submitted as a GET (not a POST) and the parameters are supplied
appropriately   (Using GET instead of POST makes both of the display
options bookmarkable).

Smert' spamionam

Site Timeline