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("selYe ar")
if selYear = "" then
selYear = currentyear
end if
currentmth= month(now())
selMonth = request.QueryString("selMo nth")
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_display Vessel)
%>
<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"> </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 ")%>"><%=r s_displayV essel("Ves selName")% ></option>
<% rs_displayVessel.MoveNext
Wend%>
</select>
Year: <select name="selYear" style="font-size:12px">
<option selected value="<%=selYear%>"><%=se lYear%></o ption>
<% for k=currentyear-4 to currentyear %>
<option value="<%=k%>"><%=k%></opt ion>
<% next %>
</select>
<input type="submit" name="btn_submit" value="View" style="width:40px; font-size:10px"> &nbs p; &n bsp;
</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_display VesselAgai n)
counter = 0
while NOT rs_displayVesselAgain.EOF
counter = counter + 1
if counter mod 3 = 1 then
%>
<tr>
<%
end if
%>
<td class="blue" onmouseover="bgColor='#F3F 3F3'" onmouseout="bgColor=''"><a href="javascript:void(0);" onClick="javascript: window.open('quarterlylist .asp?Maste rID=<%=rs_ displayVes selAgain(" MasterID") %>','','lo cation=no, toolbar=ye s, menubar=yes,scrollbars=yes ,status=ye s,resizabl e=yes,widt h=1024,hei ght=768'); " title='<%=rs_displayVessel Again("Ves selName")% > REPORT'><%=rs_displayVesse lAgain("Ve sselName") %></a></td >
<%
if counter mod 3 = 0 then
%>
</tr>
<%
end if
rs_displayVesselAgain.Move Next
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.r eload();
//window.navigate ('yearlygraph.asp?MasterID ='+frm.Mas terID.valu e+'&selYea r='+frm.se lYear.valu e);
</script>
<% 'response.Redirect("yearly graph.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 © 2006 Ocean Tankers Pte. Ltd. All rights reserved.
</div>
</font>
</body>
</html>
<!--#include file="disconn.asp"-->
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("selYe
if selYear = "" then
selYear = currentyear
end if
currentmth= month(now())
selMonth = request.QueryString("selMo
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
Set rs_displayVessel = conn.Execute(query_display
%>
<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"> </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
<% rs_displayVessel.MoveNext
Wend%>
</select>
Year: <select name="selYear" style="font-size:12px">
<option selected value="<%=selYear%>"><%=se
<% for k=currentyear-4 to currentyear %>
<option value="<%=k%>"><%=k%></opt
<% next %>
</select>
<input type="submit" name="btn_submit" value="View" style="width:40px; font-size:10px"> &nbs
</form></b></td>
</tr>
<%
query_displayVesselAgain = "SELECT * FROM Vessel WHERE Status='VALID' AND ItemInCons = 'YES' ORDER BY VesselName "
Set rs_displayVesselAgain = Server.CreateObject("ADODB
Set rs_displayVesselAgain = conn.Execute(query_display
counter = 0
while NOT rs_displayVesselAgain.EOF
counter = counter + 1
if counter mod 3 = 1 then
%>
<tr>
<%
end if
%>
<td class="blue" onmouseover="bgColor='#F3F
<%
if counter mod 3 = 0 then
%>
</tr>
<%
end if
rs_displayVesselAgain.Move
Wend
%>
<%
if Request.Form("btn_submit")
Dim mastID
Dim sYr
mastID = request("masterID")
sYr = request("selYear")
%>
<script language="JavaScript">
//frm = document.defaultform;
//parent.opener.location.r
//window.navigate ('yearlygraph.asp?MasterID
</script>
<% 'response.Redirect("yearly
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 © 2006 Ocean Tankers Pte. Ltd. All rights reserved.
</div>
</font>
</body>
</html>
<!--#include file="disconn.asp"-->
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.r eload();
//window.navigate ('yearlygraph.asp?MasterID ='+frm.Mas terID.valu e+'&selYea r='+frm.se lYear.valu e);
</script>
<% 'response.Redirect("yearly graph.asp? MasterID=" &request(" masterID") &"&selYear ="&request ("selYear" )&"")
end if
%>
<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")
Dim mastID
Dim sYr
mastID = request("masterID")
sYr = request("selYear")
%>
<script language="JavaScript">
//frm = document.defaultform;
//parent.opener.location.r
//window.navigate ('yearlygraph.asp?MasterID
</script>
<% 'response.Redirect("yearly
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.
<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?
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