I was make a
jsp page in which i am try to call javascript function
on the event of on click button. but not able to do. so please help me
to find error
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script>
var checked = false;
function checkAll(){
alert('check')
if (checked == false){
checked = true
}else{
checked = false
}
for (var i = 0; i < document.form.elements.length; i++) {
if(document.form.elements[i].type == "checkbox"){
document.form.elements[i].checked = checked;
}
}
}
function viewprofile1(){
alert('hi')
// document.forms[0].action='viewprofile.jsp';
// document.forms[0].submit;
}
</script>
</head>
<body>
<form name="form" method="post" >
<table >
<tr>
<tr>
<td class="style" >
<table border="0" >
<tr>
<td>
Search Section
</td>
</tr>
</table>
</td>
<td >
<table>
<tr>
<td class="blueheader">Service Provider</td>
<td><input type="button" onclick="viewprofile1()"></td>
<td >
Select All</td>
</tr>
</table>
<%ArrayList arraylist = (ArrayList) session.getAttribute("SPlisting");
Servicelistings servicelistings,serlis;
System.out.println("ARRAYlist--1"+arraylist);
int x=0,y=3;
ArrayList arr = new ArrayList();
for(int z=0;z<arraylist.size();z++){
serlis = (Servicelistings)arraylist.get(z);
if(serlis.getServicetype().equalsIgnoreCase("buyer")){
arr.add(serlis);
}
}
Integer length = arr.size();
System.out.println("LENGTH---"+length);
int totalpage = (length/3)+1;
System.out.println("New arraylist---"+arr);
if(request.getParameter("j")==null && request.getParameter("k")==null){
System.out.println("Inside if for j is null");
x=0; y = 3;
}
else{
System.out.println("Inside else for j not null");
x=Integer.parseInt(request.getParameter("j"));
y=Integer.parseInt(request.getParameter("k"));
}
System.out.println("How much page--"+totalpage+"--Y--"+y+"--X--"+x);
for (int i = x; i < arr.size(); i++) {
servicelistings = (Servicelistings) arr.get(i);
%>
<table>
<tr>
<td ><input type="checkbox" id="id_check" value="<%=servicelistings.getListingid()%>" ></td>
<td >-----------------------------------------------------------------------------------------------------------------------</td>
</tr>
</table>
<table border="0">
<tr>
<tr>
<td><table border="0">
<td class="greensmallheader">Posted On:
<span class="smallblackfont"><%=servicelistings.getPostingdate()%></span></td>
</table></tr>
</tr>
<td >
</td>
<td ><table border="0">
<tr><td>
<table border="0">
<td class="greensmallheader" >Listing Title : </td>
<td class="smallblackfont"><%=servicelistings.getListingtitle()%></td>
</table>
</td>
</tr>
<!-- Display Detail view -->
<tr>
<td>
<table>
<tr>
<td class="greensmallheader" >Listing Title : </td>
<td class="smallblackfont"><%=servicelistings.getListingtitle()%></td>
</tr>
<tr>
<td class="greensmallheader" >Listing Purpose : </td>
<td class="smallblackfont"><%=servicelistings.getListingpurpose()%></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td>
<table >
<!-- Give rating button-->
<tr><td >
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="
http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#faebd7">
<param name="movie" value="button8.swf">
<param name="quality" value="high">
<embed src="button8.swf" width="100" height="20" quality="high" pluginspage="
http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#faebd7" ></embed>
</object></td></tr>
</table>
</td>
</tr>
<%}%>
<table><tr><td class="orangeheader">
--------------------------------------------------------------------------------------------------------------------------
</td></tr></table>
</tr>
</table>
</form>
</body>
</html>