Okay so i am having a major problem i am using an image button to delete a recrod from a DB when i use FF it deletes perfectly runs are you sure you want to delete JS and if clicked okay deltes the record

In IE 7 however this is not the case it asks the user - refreshes and the "deleteld"entry is still there which is odd to say the least i am guessing its due to how IE process the outputted Html?

String action;

        if (request.getParameter("Add") != null) {
            action = "Add";
        } else if (request.getParameter("Delete") != null) {
            action = "Delete";
        } else if (request.getParameter("Update") != null) {
            action = "Update";
        } else {
            action = "";
        }
if (request.getParameter("Add") != null) {
            out.println("<font color=red>The User has been added</font>");
        } else if (request.getParameter("Delete") != null) {
            out.println("<font color=red>The User has been Deleted</font>");
        } else if (request.getParameter("Update") != null) {
            out.println("<font color=red>The User has been Updated</font>");
        } else {
            out.println("<font color=red>Please enter details of the user you wish to add </font>");
        }
out.println("<input name='Delete' type='image' src ='images/del.png'value=" + id + " alt='Delete' onclick='javascript:return deltest();'/>  ");

When the user presses the add and update buttons it works perfectly on IE and FF it is just the delete button which does not seem to work in IE

example i press Add user and input the details
it will print out he User has been added
and will Add the entry

same with update

in bot FF and IE

Delete however functions 100% in FF
and Not if IE in IE it wont even display the message the user is deleted but will run the JS

(request.getParameter("Delete")!=null) {


            String todelete = request.getParameter("Delete");
            out.println(todelete);
            














            String sqld = "DELETE FROM tablename WHERE id='" + todelete + "'";
            out.println(sqld);

            access.execute(sqld);















        }

Recommended Answers

All 4 Replies

I don't know if this will solve the problem, but at this line:

out.println("<input name='Delete' type='image' src ='images/del.png'value=" + id + " alt='Delete' onclick='javascript<b></b>:return deltest();'/>  ");

You need a space between the value:

'images/del.png'value

And here you need to add the single quotes:

out.println("<input name='Delete' type='image' src ='images/del.png'value='" + id + "' alt='Delete' onclick='javascript<b></b>:return deltest();'/> ");

Like you did for alt='Delete' Also, although the same, you can write it like this:

<input name='Delete' type='image' src ='images/del.png' 
value='<%= id%>' 
alt='Delete' onclick='javascript: return deltest();' />

I think it is easier to write it directly as html inside the jsp file

Java Addict ! Thank you for the Post i had not realised i screwed up the commas - i have not tested the changes yet as i am away from the dev pc - but i appreciate your help!

Nope that did not fix the error but thanks !

okay i know what the problem is now the getperameter function does not pick up when an image is clicked however it does with a button

so i am makinh a delete button and covering with with css image

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.