Link to home
Start Free TrialLog in
Avatar of Yannie
Yannie

asked on

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



Avatar of Dirar Abu Kteish
Dirar Abu Kteish
Flag of Palestine, State of image

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
Avatar of Yannie
Yannie

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Dirar Abu Kteish
Dirar Abu Kteish
Flag of Palestine, State of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can u please explain why you have this line " if Request.Form("btn_submit") = "View" then ", what is it good for?
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
%>
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.
Shall he also keep things that he doesn't need?