|
-
Dec 6th, 2001, 09:50 AM
#1
Thread Starter
Frenzied Member
Two buttons with different forms
The first button I want to make a calculation with and when the other button is clicked I want a new window to pop up. How can this be done?
-
Dec 6th, 2001, 10:56 AM
#2
Frenzied Member
Uhm... the same way you would do it if there was only one button and one form.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Dec 6th, 2001, 12:24 PM
#3
well the first buton would have
onclick="yourfunction()" then on the second button you would have onclick="popup_function()"
but you would have to have these function in javascript in your page.
-
Dec 7th, 2001, 02:11 AM
#4
Thread Starter
Frenzied Member
Well if I have a form with an action, how can I get two different output pages? The form has an action which is applied when the submit is clicked, what about the button? I have tried the code below, but nothing happens when I hit the button.
My code is
Code:
<form name="form2" method="post" action="fessor.asp">
<TD>
<p align="left">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD COLSPAN="3" BGCOLOR="#000000"><DIV STYLE="COLOR: white; PADDING-BOTTOM: 2px;
PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center"><b>Resultater</DIV></B></TD></B>
</TR>
<TR><TD WIDTH="1" BGCOLOR="#000000"><!-- venstre kant --></TD>
<TD><!-- Miderste kolonne m. indhold -->
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">
<style>
.AlignClass
{
text-align:center;
}
</style>
<tr>
<td>Kappediameter</td>
<td><INPUT type="text" id=text4 name=text4 size=4 class="AlignClass" value = <%=d_kappe%> readonly> m</td>
</tr>
<tr>
<td>Varmeovergangskoeff.</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(u,2)%>> W/m<sup>2</sup>K</td>
<tr>
<tr>
<td>Varmetab</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(tab1,1)%>> W/m</td>
<tr>
<tr>
<td>Totalt varmetab</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(vtab,0)%>> W</td>
</tr>
<tr>
<td>Temperatur v. <%=length%> m</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(t_end,1)%>> °C</td>
</tr>
<tr>
<td>Afkølingstid</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(tid,1)%>> h</td>
</tr>
</TABLE>
</TD><TD WIDTH="1" BGCOLOR="#000000"><!-- højre kant --></TD></TR>
<TR><TD COLSPAN="3" HEIGHT="2" BGCOLOR="#000000"><!-- underkant --></TD>
</TR>
<tr>
<td></td>
<td><INPUT type="button" value="Button" id=button1 name=button1 onclick="print.asp" target="_blank"> </td>
</tr>
</TABLE>
<input type=submit name="Submit1" value="Se graf">
-
Dec 7th, 2001, 10:59 AM
#5
that is because your
onclick="print.asp"
has to be a function of javascript.
onclick="print()"
then in that print() function you load the print.asp page.
or you can have 2 different forms
Code:
<form name="form2" method="post" action="fessor.asp">
<TD>
<p align="left">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD COLSPAN="3" BGCOLOR="#000000"><DIV STYLE="COLOR: white; PADDING-BOTTOM: 2px;
PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; TEXT-ALIGN: center"><b>Resultater</DIV></B></TD></B>
</TR>
<TR><TD WIDTH="1" BGCOLOR="#000000"><!-- venstre kant --></TD>
<TD><!-- Miderste kolonne m. indhold -->
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="3">
<style>
.AlignClass
{
text-align:center;
}
</style>
<tr>
<td>Kappediameter</td>
<td><INPUT type="text" id=text4 name=text4 size=4 class="AlignClass" value = <%=d_kappe%> readonly> m</td>
</tr>
<tr>
<td>Varmeovergangskoeff.</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(u,2)%>> W/m<sup>2</sup>K</td>
<tr>
<tr>
<td>Varmetab</td>
<td><INPUT type="text" id=text1 name=text1 readonly size=4 class="AlignClass" value=<%=round(tab1,1)%>> W/m</td>
<tr>
<tr>
<td>Totalt varmetab</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(vtab,0)%>> W</td>
</tr>
<tr>
<td>Temperatur v. <%=length%> m</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(t_end,1)%>> °C</td>
</tr>
<tr>
<td>Afkølingstid</td>
<td><INPUT type="text" id=text2 name=text2 readonly size=4 class="AlignClass" value=<%=round(tid,1)%>> h</td>
</tr>
</TABLE>
</TD><TD WIDTH="1" BGCOLOR="#000000"><!-- højre kant --></TD></TR>
<TR><TD COLSPAN="3" HEIGHT="2" BGCOLOR="#000000"><!-- underkant --></TD>
</TR>
<tr>
<td><input type=submit name="Submit1" value="Se graf"></td></form>
<td>
<form action="print.asp" method=post name=form3>
<INPUT type="button" value="Button" id=button1 name=button1> </form></td>
</tr>
</TABLE>
-
Dec 10th, 2001, 02:29 AM
#6
Thread Starter
Frenzied Member
OK, could you please tell me how to load an ASP-page in a JavaScript function, then I don't need a set of forms.
-
Dec 10th, 2001, 08:56 AM
#7
just use what I showed you. it has to forms, the easiest way to do it.
-
Dec 12th, 2001, 03:07 AM
#8
Thread Starter
Frenzied Member
well, the problem is that nothing happens when I hit the button. Are you sure it's the same code when you use button instead of submit?
-
Dec 12th, 2001, 09:00 AM
#9
if you are going to use 2 forms, yes you will need to change the button to a submit, sorry forgot about that one.
-
Dec 13th, 2001, 09:01 AM
#10
Member
You don't need to use two forms (and I'm thinking if you do, there won't be any data posted from that second empty form - not sure about that tho')
Try stg like this:
<input type=submit value="Ammend Order Details" onClick="document.frmhidden.action='Products.asp?ammend=true';" name=ammendorder>
The other button can be just a normal submit, that will execute the form's action attribute.
Hope this helps.
DJ
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|