• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Open a new Window

Can anyone help me with this..
I'm trying to open a new window but it fails several times..how do i go abt doing it? That means once i Hit the "View" button it will load  a new page. Thanks..! Urgent please!

The script i have is as below

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="conn.asp"-->
<%      
      currentyear = year(now())
      selYear = request.QueryString("selYear")
      if selYear = "" then
            selYear = currentyear
      end if

      currentmth= month(now())
      selMonth = request.QueryString("selMonth")
      if selMonth = "" then
            selMonth = currentmth
      end if

      'query_displayVessel = "SELECT * FROM Vessel WHERE Status='VALID' AND VMS_Vessel = 'YES' ORDER BY VesselName "
      query_displayVessel = "SELECT * FROM Vessel WHERE Status='VALID' AND ItemInCons = 'YES' ORDER BY VesselName "
      Set rs_displayVessel = Server.CreateObject("ADODB.Recordset")
      Set rs_displayVessel = conn.Execute(query_displayVessel)
      
%>
<html>
<head>
<title>Lub Oil Consumption Report</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>

<body topmargin="0" leftmargin="0">
<table>
<tr>
      <td height="30">&nbsp;</td>
</tr>
</table>
<table align="center" width="80%" border="1" cellspacing="0" cellpadding="5" height="30">
<tr>
    <th align="center" height="40" colspan="4"><b>SELECT VESSEL TO VIEW OIL CONSUMPTION REPORT</b></th>
</tr>

<tr>
    <td align="center" height="40" colspan="4"><b>YEARLY GRAPH:  
      <form name="defaultform" method="post" action="default.asp">
       VESSEL: <select name="MasterID" style="font-size:12px">      
            <option select value="">Please choose</option>
             <%      While NOT rs_displayVessel.EOF%>
           <option value="<%=rs_displayVessel("MasterID")%>"><%=rs_displayVessel("VesselName")%></option>
            <% rs_displayVessel.MoveNext
                  Wend%>
            </select>
            
       
      Year: <select name="selYear" style="font-size:12px">
          <option selected value="<%=selYear%>"><%=selYear%></option>
          <% for k=currentyear-4 to currentyear %>
          <option value="<%=k%>"><%=k%></option>
          <% next %>
        </select>
        &nbsp;
            <input type="submit" name="btn_submit" value="View" style="width:40px; font-size:10px">&nbsp;&nbsp;&nbsp;&nbsp;
            </form></b></td>
</tr>
<%
      query_displayVesselAgain = "SELECT * FROM Vessel WHERE Status='VALID' AND ItemInCons = 'YES' ORDER BY VesselName "
      Set rs_displayVesselAgain = Server.CreateObject("ADODB.Recordset")
      Set rs_displayVesselAgain = conn.Execute(query_displayVesselAgain)
      
      counter = 0
      while NOT rs_displayVesselAgain.EOF
      counter = counter + 1
      if counter mod 3 = 1 then
%>
<tr>
<%
      end if
%>      

      <td class="blue" onmouseover="bgColor='#F3F3F3'" onmouseout="bgColor=''"><a href="javascript:void(0);" onClick="javascript: window.open('quarterlylist.asp?MasterID=<%=rs_displayVesselAgain("MasterID")%>','','location=no,toolbar=yes, menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=1024,height=768');" title='<%=rs_displayVesselAgain("VesselName")%> REPORT'><%=rs_displayVesselAgain("VesselName")%></a></td>
<%
            if counter mod 3 = 0 then
%>
</tr>
<%
            end if
      rs_displayVesselAgain.MoveNext
      Wend
%>
<%
      if Request.Form("btn_submit") = "View" then
      Dim mastID
      Dim sYr
      mastID = request("masterID")
      sYr = request("selYear")
      
      %>
      <script language="JavaScript">
      
      //frm = document.defaultform;
      //parent.opener.location.reload();
      //window.navigate ('yearlygraph.asp?MasterID='+frm.MasterID.value+'&selYear='+frm.selYear.value);
      </script>
            
      <% 'response.Redirect("yearlygraph.asp?MasterID="&request("masterID")&"&selYear="&request("selYear")&"")
            end if
%>
</table>
<font face="Verdana, Arial, Helvetica, sans-serif" style="font-size:10px" color="#999999">
<div align="center">
<hr width="80%" noshade size="1" color="lightgrey" style="margin-top:5px">
  Copyright &copy; 2006 Ocean Tankers Pte. Ltd. All rights reserved.
</div>
</font>
</body>
</html>
<!--#include file="disconn.asp"-->



0
Yannie
Asked:
Yannie
  • 5
1 Solution
 
Dirar Abu KteishCommented:
Hello  Yannie,
as I see that the "View" button is submit button, now when someone clicks on this button, what do u exactly want to do? u said opens a new page, do u still want to show the old one?

-Dirar
0
 
YannieAuthor Commented:
the old one will stay...meaning when it clicks the button..it gets the masterid and selyear parameters and opens a new window totally. the old page remains so pple can select.
0
 
Dirar Abu KteishCommented:
You can change the form action to open on a new page every time u click the submit button
<form name="defaultform" method="post" target="_blank" action="newpage.html">

if you need two submit buttons on the same page please specify

-Dirar
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Dirar Abu KteishCommented:
can u please explain why you have this line " if Request.Form("btn_submit") = "View" then ", what is it good for?
0
 
Dirar Abu KteishCommented:
I forgot to mention that when submitting the parameters inside the submitted form will be passed to the page that is specified inside the action attribute.. so in your case just modify the line:
<form name="defaultform" method="post" action="default.asp">
to
<form name="defaultform" method="post" target="_blank" action="newpage.html">

and change action="newpage.html" to the page you want to submit the form data to..

then delete

<%
     if Request.Form("btn_submit") = "View" then
     Dim mastID
     Dim sYr
     mastID = request("masterID")
     sYr = request("selYear")
     
     %>
     <script language="JavaScript">
     
     //frm = document.defaultform;
     //parent.opener.location.reload();
     //window.navigate ('yearlygraph.asp?MasterID='+frm.MasterID.value+'&selYear='+frm.selYear.value);
     </script>
         
     <% 'response.Redirect("yearlygraph.asp?MasterID="&request("masterID")&"&selYear="&request("selYear")&"")
          end if
%>
0
 
pashikCommented:
just write in form target=_blank:
<form name="defaultform" method="post" action="default.asp" target=_blank>
So when u click submit button View it will be opened new window.
0
 
Dirar Abu KteishCommented:
Shall he also keep things that he doesn't need?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now