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"-->



YannieAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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.
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Dirar Abu KteishCommented:
can u please explain why you have this line " if Request.Form("btn_submit") = "View" then ", what is it good for?
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
%>
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.
Dirar Abu KteishCommented:
Shall he also keep things that he doesn't need?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.