Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write answer to a new side

Status
Not open for further replies.

shaygan

Programmer
Feb 19, 2005
12
DE
hey,

this Script write to the same side, but
i will that the answer be written in a
new html side.


<html>
<body>
<form action="demo.asp" method="get">
Your name: <input type="text" name="fname" size="20">
<input type="submit" value="Submit">
</form>
<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
Response.Write("Hello " & fname & "!<br />")

End If
%>
</body>
</html>

i tried this:
Response.Write("<html><head></head><body>" & fname &"</body></html>")

but it does'nt work

??
 
I'm not sure I understand, what "sides" are you talking about?

barcode_1.gif
 
with side i mean a separate ( a new )html side,
because of that i tryed with this Response.Write("<html><head></head><body>" & fname &"</body></html>")
but it does not seem to be correct :(
 
An ASP script can only output one page at a time. If it is called from a frame, it can only provide the HTML to be displayed for that one frame. You could build a piece of ASP code to return either a left or right side based on a variable in the querystring but you still would have to call it once from each side in order to display the correct result in each side. Frames and etc are client-side, ASP only knows that it is returning a single HTML file.

On the other hand you can make it look like two seperate sections uising tables or floating divs or somesuch.

-T

barcode_1.gif
 
shaygan,

I'm with Tarwn. I don't understand the sides? I assume you mean page. If so, use the redirect function. Your code simply does what your if condition is telling it to do...write the name to the demo.asp page. Therefore you need to remove the write and replace with redirect and add the page and var.

demo.asp

Code:
<html>
<body>
<form action="demo.asp" method="get">
Your name: <input type="text" name="fname" size="20">
<input type="submit" value="Submit">
</form>
<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
       Response.Redirect "newpage.asp?fname=" & fname & ""

End If
%>
</body>
</html>


newpage.asp

Code:
<html>
<body>

<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
     Response.Write "Hello, " & fname

End If
%>
</body>
</html>

 
Ahhh, ok Tarwn, that makes sense. Thanks for clarifying.

CSS should be fine for what you're trying to achieve shaygan...perhaps this snippet will get you in the right direction: Use 2 div tags to get the affect of "2 sides"
left column will hold the form and when submitted...the answer will show up in the right column...experiment with the styles to get the best results for YOU...hope it helps

Code:
<html>
  <head>
   <style type="text/css"> 
   
    body{
         margin: 0px;
         padding:0px;
        }
 
   #leftcol{
            width: 25%;
            height:100%;
	    float: left;
	    border: solid #333333;
	    border-width: 0px 2px 0px 0px;
	    background: #ccc;
 	    color: #000;
	    margin: 0px;
	   padding: 10px;
          }
 
   #rightcol{
             background: #fff;
	     color: #000;
	     margin-left: 0px;
 	     padding: 10px;
	     height:100%;
            }
   </style>
  </head>
 <body>
  <div id="leftcol">
   <form action="demo.asp" method="get">
    Your name: <input type="text" name="fname" size="20">
               <input type="submit" value="Submit">
   </form>
  </div>
 <div id="rightcol">

<%
  dim fname
  fname=Request.QueryString("fname")

  If fname<>"" Then
       Response.Write "Hello, " & fname 

  End If
%>

  </div>
 </body>
</html>

BSL

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top