|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
problem with several rows for fade effect
okay i have a problem...i get the content of my rows from my database... the problem is when there is 4 rows... and i try to click on the 1st row... instead of it being deleted the 3rd row is deleted.. when i click on the 2nd row... the 4th row is delete...
the moveicon.gif is the image for deleting the row.. there is no problem when i remove the javascript...but when i applied it i noticed the poblem Code:
<table width="759" border="0">
<tr>
<td colspan="5"><span class="style8">Confirmed Request</span> </td>
</tr>
<tr>
<td width="105" bgcolor="#408080"><span class="style5">Type</span></td>
<td width="463" bgcolor="#408080"><span class="style5">Topic</span></td>
<td width="108" bgcolor="#408080"><span class="style5">Date</span></td>
<td width="25" bgcolor="#408080"><div align="center"></div></td>
<td width="36" bgcolor="#408080"><div align="center"></div></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%
int i = 0;
CachedRowSetImpl crset3 = new CachedRowSetImpl();
crset3 = view.home2();
while (crset3.next())
{
String day3 = crset3.getString("dep_date");
String[] monthcol2= day3.split("-");
year = Integer.parseInt(monthcol2[0]);
month = Integer.parseInt(monthcol2[1]);
day= Integer.parseInt(monthcol2[2]);
m="";
if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}
if(i==0)
{
%>
<tr>
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
function confirmation1(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$("#movieIcon").parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>";
}
else{
}
}
//-->
</script>
<td scope="row"><fade1><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %> </span> </div></fade1></td>
<td scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_name")%></a>
</span> </div></td>
<td > <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=yes,scrollbars=yes,status=yes,width=640,height=500'); if (chw != null) chw.focus(); return false"><img src="../Chapters/images/reporticon.gif" border="0"></a></div></td>
<td ><div align="center"><img id="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" onClick="confirmation1()"/></div></td>
</tr>
<%
i=1;
}
else
{
%>
<tr>
<script type="text/javascript">
<!--
<!--
function confirmation(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$("#movieIcon1").parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>";
}
else{
}
}
//-->
//-->
</script>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %></span> </div></td>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"><%= crset3.getString("dep_name")%>
</span> </div></td>
<td bgcolor="#CCCCCC"> <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td bgcolor="#CCCCCC"> <a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=no,scrollbars=yes,status=no,width=640,height=500'); if (chw != null) chw.focus(); return false"><div align="center"><img src="../Chapters/images/reporticon.gif" border="0"></div>
</a></td>
<td bgcolor="#CCCCCC" ><div align="center"><img id="movieIcon1" src="images/moveicon.gif" width="29" height="29" border="0" onClick="confirmation()"></div></td>
</tr>
<%
i=0;
}
}
%>
</table>
|
|
#2
|
|||
|
|||
|
anyone?
|
|
#3
|
|||
|
|||
|
First you are looping to build the table so use a class instead of the ID.
Code:
<img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" /> Code:
$(document).ready(
function (){
$(".movieIcon").each().click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$(this).parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp ..... blah blah blah";
}
);
}
);
|
|
#4
|
|||
|
|||
|
is it something like this?
i tried it but when i click the image nothing happens Code:
<table width="759" border="0">
<tr>
<td colspan="5"><span class="style8">Confirmed Request</span> </td>
</tr>
<tr>
<td width="105" bgcolor="#408080"><span class="style5">Type</span></td>
<td width="463" bgcolor="#408080"><span class="style5">Topic</span></td>
<td width="108" bgcolor="#408080"><span class="style5">Date</span></td>
<td width="25" bgcolor="#408080"><div align="center"></div></td>
<td width="36" bgcolor="#408080"><div align="center"></div></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%
int i = 0;
CachedRowSetImpl crset3 = new CachedRowSetImpl();
crset3 = view.home2();
while (crset3.next())
{
String day3 = crset3.getString("dep_date");
String[] monthcol2= day3.split("-");
year = Integer.parseInt(monthcol2[0]);
month = Integer.parseInt(monthcol2[1]);
day= Integer.parseInt(monthcol2[2]);
m="";
if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}
if(i==0)
{
%>
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").each().click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$(this).parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>";
}
);
}
);
//-->
</script>
<tr>
<td scope="row"><fade1><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %> </span> </div></fade1></td>
<td scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_name")%></a>
</span> </div></td>
<td > <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=yes,scrollbars=yes,status=yes,width=640,height=500'); if (chw != null) chw.focus(); return false"><img src="../Chapters/images/reporticon.gif" border="0"></a></div></td>
<td ><div align="center"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" /></div></td>
</tr>
<%
i=1;
}
else
{
%>
<tr>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %></span> </div></td>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"><%= crset3.getString("dep_name")%>
</span> </div></td>
<td bgcolor="#CCCCCC"> <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td bgcolor="#CCCCCC"> <a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=no,scrollbars=yes,status=no,width=640,height=500'); if (chw != null) chw.focus(); return false"><div align="center"><img src="../Chapters/images/reporticon.gif" border="0"></div>
</a></td>
<td bgcolor="#CCCCCC" ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>"><img id="movieIcon1" src="images/moveicon.gif" width="29" height="29" border="0" ></a></div></td>
</tr>
<%
i=0;
}
}
%>
</table>
|
|
#5
|
|||
|
|||
|
hey can anyone help me with this? i just need to know how to call the class="moveicon" and what does it mean to bind the click event?
Last edited by sher_amf; 11-06-2009 at 02:58 AM. |
|
#6
|
|||
|
|||
|
Thought I replied to this, I guess not.
Code:
<table width="759" border="0">
<tr>
<td colspan="5"><span class="style8">Confirmed Request</span> </td>
</tr>
<tr>
<td width="105" bgcolor="#408080"><span class="style5">Type</span></td>
<td width="463" bgcolor="#408080"><span class="style5">Topic</span></td>
<td width="108" bgcolor="#408080"><span class="style5">Date</span></td>
<td width="25" bgcolor="#408080"><div align="center"></div></td>
<td width="36" bgcolor="#408080"><div align="center"></div></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%
int i = 0;
CachedRowSetImpl crset3 = new CachedRowSetImpl();
crset3 = view.home2();
while (crset3.next())
{
String day3 = crset3.getString("dep_date");
String[] monthcol2= day3.split("-");
year = Integer.parseInt(monthcol2[0]);
month = Integer.parseInt(monthcol2[1]);
day= Integer.parseInt(monthcol2[2]);
m="";
if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}
if(i==0)
{
%>
<tr>
<td scope="row"><fade1><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %> </span> </div></fade1></td>
<td scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_name")%></a>
</span> </div></td>
<td > <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=yes,scrollbars=yes,status=yes,width=640,height=500'); if (chw != null) chw.focus(); return false"><img src="../Chapters/images/reporticon.gif" border="0"></a></div></td>
<td ><div align="center"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" /></div></td>
</tr>
<%
i=1;
}
else
{
%>
<tr>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %></span> </div></td>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"><%= crset3.getString("dep_name")%>
</span> </div></td>
<td bgcolor="#CCCCCC"> <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td bgcolor="#CCCCCC"> <a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=no,scrollbars=yes,status=no,width=640,height=500'); if (chw != null) chw.focus(); return false"><div align="center"><img src="../Chapters/images/reporticon.gif" border="0"></div>
</a></td>
<td bgcolor="#CCCCCC" ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" ></a></div></td>
</tr>
<%
i=0;
}
}
%>
</table>
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$(this).parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>";
}
);
}
);
//-->
</script>
|
|
#7
|
|||
|
|||
|
hey this is what i did...
i tried using your code but i get an invalid cursor error hope you could help me with this.=) really appreciate your help! when i place the javascript outside the table the error occurs Code:
<table width="759" border="0">
<tr>
<td colspan="5"><span class="style8">Confirmed Request</span> </td>
</tr>
<tr>
<td width="105" bgcolor="#408080"><span class="style5">Type</span></td>
<td width="463" bgcolor="#408080"><span class="style5">Topic</span></td>
<td width="108" bgcolor="#408080"><span class="style5">Date</span></td>
<td width="25" bgcolor="#408080"><div align="center"></div></td>
<td width="36" bgcolor="#408080"><div align="center"></div></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%
int i = 0;
CachedRowSetImpl crset3 = new CachedRowSetImpl();
crset3 = view.home2();
while (crset3.next())
{
String day3 = crset3.getString("dep_date");
String[] monthcol2= day3.split("-");
year = Integer.parseInt(monthcol2[0]);
month = Integer.parseInt(monthcol2[1]);
day= Integer.parseInt(monthcol2[2]);
m="";
if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}
if(i==0)
{
%>
<tr>
<td scope="row"><fade1><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %> </span> </div></fade1></td>
<td scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_name")%></a>
</span> </div></td>
<td > <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=yes,scrollbars=yes,status=yes,width=640,height=500'); if (chw != null) chw.focus(); return false"><img src="../Chapters/images/reporticon.gif" border="0"></a></div></td>
<td ><div align="center"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" /></div></td>
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
$(this).parents("tr").fadeOut("slow");
window.location = "http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>";
}
);
}
);
//-->
</script>
</tr>
<%
i=1;
}
else
{
%>
<tr>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %></span> </div></td>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"><%= crset3.getString("dep_name")%>
</span> </div></td>
<td bgcolor="#CCCCCC"> <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td bgcolor="#CCCCCC"> <a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=no,scrollbars=yes,status=no,width=640,height=500'); if (chw != null) chw.focus(); return false"><div align="center"><img src="../Chapters/images/reporticon.gif" border="0"></div>
</a></td>
<td bgcolor="#CCCCCC" ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" ></a></div></td>
</tr>
<%
i=0;
}
}
%>
</table>
|
|
#8
|
|||
|
|||
|
Yep I forgot about your loop. On the same position where I placed the js codes try this
Code:
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
var target = #(this).parents("a").attr("href");
$(this).parents("tr").fadeOut("slow");
window.location = target;
}
}
);
}
);
|
|
#9
|
|||
|
|||
|
unfortunately still doesn't work and the problem is when i click the movicon still nothing happens... here is the final code based on what you said
Code:
<table width="759" border="0">
<tr>
<td colspan="5"><span class="style8">Confirmed Request</span> </td>
</tr>
<tr>
<td width="105" bgcolor="#408080"><span class="style5">Type</span></td>
<td width="463" bgcolor="#408080"><span class="style5">Topic</span></td>
<td width="108" bgcolor="#408080"><span class="style5">Date</span></td>
<td width="25" bgcolor="#408080"><div align="center"></div></td>
<td width="36" bgcolor="#408080"><div align="center"></div></td>
</tr>
<%@ page import="com.sun.rowset.CachedRowSetImpl;" %>
<%
int i = 0;
CachedRowSetImpl crset3 = new CachedRowSetImpl();
crset3 = view.home2();
while (crset3.next())
{
String day3 = crset3.getString("dep_date");
String[] monthcol2= day3.split("-");
year = Integer.parseInt(monthcol2[0]);
month = Integer.parseInt(monthcol2[1]);
day= Integer.parseInt(monthcol2[2]);
m="";
if(month==1)
{
m="Jan";
}
else if (month==2)
{
m="Feb";
}
else if (month==3)
{
m="March";
}
else if (month==4)
{
m="April";
}
else if (month==5)
{
m="May";
}
else if (month==6)
{
m="June";
}
else if (month==7)
{
m="July";
}
else if (month==8)
{
m="Aug";
}
else if (month==9)
{
m="Sept";
}
else if (month==10)
{
m="Oct";
}
else if (month==11)
{
m="Nov";
}
else if (month==12)
{
m="Dec";
}
if(i==0)
{
%>
<tr>
<td scope="row"><fade1><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %> </span> </div></fade1></td>
<td scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_name")%></a>
</span> </div></td>
<td > <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=yes,scrollbars=yes,status=yes,width=640,height=500'); if (chw != null) chw.focus(); return false"><img src="../Chapters/images/reporticon.gif" border="0"></a></div></td>
<td ><div align="center"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" /></div></td>
</tr>
<%
i=1;
}
else
{
%>
<tr>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"> <%= crset3.getString("dep_type") %></span> </div></td>
<td bgcolor="#CCCCCC" scope="row"><div align="left" class="style22"><span class="style7"><%= crset3.getString("dep_name")%>
</span> </div></td>
<td bgcolor="#CCCCCC"> <span class="style7">
<% out.println(day);%>
<% out.println("-");%>
<% out.println(m);%>
<% out.println("-");%>
<% out.println(year);%>
</span></td>
<td bgcolor="#CCCCCC"> <a href="http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>" onClick="chw=window.open('http://localhost:8080/ICTPROJ/deployment/reports_2.jsp?t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>','NewWindow','resizable=no,scrollbars=yes,status=no,width=640,height=500'); if (chw != null) chw.focus(); return false"><div align="center"><img src="../Chapters/images/reporticon.gif" border="0"></div>
</a></td>
<td bgcolor="#CCCCCC" ><div align="center"><a href="http://localhost:8080/ICTPROJ/deployment/archiver.jsp?r=<%=crset3.getString("ref_num")%>&t=<%=crset3.getString("dep_time")%>&l=<%= crset3.getString("dep_location") %>&d=<%= crset3.getString("dep_date") %>"><img class="movieIcon" src="images/moveicon.gif" width="29" height="29" border="0" ></a></div></td>
</tr>
<%
i=0;
}
}
%>
</table>
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
var target = #(this).parents("a").attr("href");
$(this).parents("tr").fadeOut("slow");
window.location = target;
}
}
);
}
);
//-->
</script>
|
|
#10
|
|||
|
|||
|
Try this first
Code:
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var target = $(this).parents("a").attr("href");
alert(target);
}
);
}
);
Code:
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
var target = $(this).parents("a").attr("href");
$(this).parents("tr").fadeOut("slow");
window.location = target;
}
}
);
}
);
Last edited by ssystems; 11-07-2009 at 08:04 PM. |
|
#11
|
|||
|
|||
|
it works but the problem is that when i click cancel it still redirects the page.. it should be that when my cancel the alert is noting happens
|
|
#12
|
|||
|
|||
|
O that's what you meant. Just return false when they chose cancel
Code:
<script src="images/jquery-latest.js"></script>
<script type="text/javascript">
<!--
$(document).ready(
function (){
$(".movieIcon").click(
function(){
var answer = confirm("Do you want to move this to archives?")
if (answer){
var target = $(this).parents("a").attr("href");
$(this).parents("tr").fadeOut("slow");
window.location = target;
}
else{
return false;
}
}
);
}
);
|
|
#13
|
|||
|
|||
|
thank you very much!!
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|