Squall Leonhart
11-17-2003, 06:53 PM
Hi, everyone
Please take a look at following code
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="HM_Loader.js" TYPE='text/javascript'></SCRIPT>
<script language="JavaScript" type="text/javascript">
function whichChoice(YesNo)
{
if (confirm("Are you sure you want to delete this article?")){
window.location.href='updateRequest.asp?state=delete'
}
}
</script>
</HEAD>
<BODY LEFTMARGIN=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<form name="frmDelete" method="post" onSubmit="return dateDiff(this);">
<table ALIGN=CENTER border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<th colspan="6" height="25"><b>Choose the items you want to delete</b></th>
</tr>
<tr>
<td width=1%> </td>
<td align=center><span class="gen"><b>Description</b></span></td>
<td width=2%> </td>
</tr>
<tr>
<td width=1%></td>
<td align=center><select name="selectDel" style="width:300px;" size="6" multiple="multiple">
<% Do while not rsEdit.eof %>
<option value="<%=rsEdit.fields("ID")%>"><%=rsEdit.fields.item("description").value%></option>
<% rsEdit.Movenext
Loop
%>
</select></td>
<td width=2%> </td>
</tr>
</form>
<tr><td><br></td></tr>
<tr>
<th colspan="13" height="25"><input type="submit" name="erase" value="DELETE" onclick="whichChoice()"></th>
</tr>
</table>
</BODY>
</HTML>
As you can see when I click the Delete button, I will get the message box asking me "Are you sure you want to delete this article?". But before that I want Javascript function to check whether or not any value from listbox 'selectDel' is selected. And if no value from listbox is selected, then I want to show the alert message box like "Items are not selected"
So I tried the code like
<script language="JavaScript" type="text/javascript">
function whichChoice(YesNo)
{
if (document.frmDelete.selectDel.value == ""){ Alert "Items are not selected"
else
}
if (confirm("Are you sure you want to delete this article?")){
window.location.href='updateRequest.asp?state=delete'
}
}
</script>
Code doesn't work. I don't know how I am going to solve this.
:(
Please help me.
Please take a look at following code
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="HM_Loader.js" TYPE='text/javascript'></SCRIPT>
<script language="JavaScript" type="text/javascript">
function whichChoice(YesNo)
{
if (confirm("Are you sure you want to delete this article?")){
window.location.href='updateRequest.asp?state=delete'
}
}
</script>
</HEAD>
<BODY LEFTMARGIN=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<form name="frmDelete" method="post" onSubmit="return dateDiff(this);">
<table ALIGN=CENTER border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<th colspan="6" height="25"><b>Choose the items you want to delete</b></th>
</tr>
<tr>
<td width=1%> </td>
<td align=center><span class="gen"><b>Description</b></span></td>
<td width=2%> </td>
</tr>
<tr>
<td width=1%></td>
<td align=center><select name="selectDel" style="width:300px;" size="6" multiple="multiple">
<% Do while not rsEdit.eof %>
<option value="<%=rsEdit.fields("ID")%>"><%=rsEdit.fields.item("description").value%></option>
<% rsEdit.Movenext
Loop
%>
</select></td>
<td width=2%> </td>
</tr>
</form>
<tr><td><br></td></tr>
<tr>
<th colspan="13" height="25"><input type="submit" name="erase" value="DELETE" onclick="whichChoice()"></th>
</tr>
</table>
</BODY>
</HTML>
As you can see when I click the Delete button, I will get the message box asking me "Are you sure you want to delete this article?". But before that I want Javascript function to check whether or not any value from listbox 'selectDel' is selected. And if no value from listbox is selected, then I want to show the alert message box like "Items are not selected"
So I tried the code like
<script language="JavaScript" type="text/javascript">
function whichChoice(YesNo)
{
if (document.frmDelete.selectDel.value == ""){ Alert "Items are not selected"
else
}
if (confirm("Are you sure you want to delete this article?")){
window.location.href='updateRequest.asp?state=delete'
}
}
</script>
Code doesn't work. I don't know how I am going to solve this.
:(
Please help me.