469,323 Members | 1,551 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

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

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
frame...how do I do this? Heres an example of my html (just one button
shown here):

<html>
<head>
<body>
<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 & _
"</th>"
Next
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 & _
"</td>"
Next
myResultTable = myResultTable & "</tr>"
recordSet.MoveNext
Loop
myResultTable = myResultTable & "</table>"
recordSet.Close
oConnection.Close

Results.innerHTML = myResultTable
End Sub

</script>
<input type="button" id="btnListBackups" value="List Backups">
<hr>
<nobr Id=Results></nobr>
</body>
</html>
Jul 23 '05 #1
1 1247
On 18 Oct 2004 12:00:42 -0700, em*****@netscape.net (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
to.

"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
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ian Kelly | last post: by
1 post views Thread by doris1202004 | last post: by
reply views Thread by starkman | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.