Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnClick Not Working

Status
Not open for further replies.

squirleegirl

Programmer
Jun 24, 2003
59
US
Greetings!

I have an asp page that is two frames (left & right). On the left side is a menu with events on it with a "Delete" link for each record.

When the Delete link is clicked, I have a javascipt code that prompts for the reason you are deleting the record and then closes the asp page that opened with the delete prompt and returns you to the page (unrefreshed).

I would like the page to close itself if the link is clicked. I have added an OnClick statement to the following link:

Response.Write("<TD><a target=anothernew href='deleterecord.asp?id=" & varID & "&Student=" & varStudent & "&ClassPos=" & varClassPos & "&FType=" & rs("fldID") & "&DType=DeviceSummary' onclick='Delete()'><FONT color=red face=Arial size=1>Delete</a></FONT>")

And the javascript function is:
<script language="JavaScript">
function delete() {
window.opener.location=window.opener.location;
window.close();
}
</script>

I get the little error message in the bottom of my browser (IE 6) stating the page loaded but with errors. The error states an expecting '(', but I cannot figure it where.

Does anyone have any suggestions?

Thanks in advance.
 
i cannot see an error straight away. but:
1. why -window.opener.location=window.opener.location???
2. can i have a view source of the page? it maybe that the error maybe in some other javascript...

Known is handfull, Unknown is worldfull
 
I'm using the window.opener.location = window.opener location because the page I am wanting to close is a child frame and I want it to refresh the parent when it closes.

Come to think of it, I don't really know why I'm using that except it is in another piece of code that is working.

As far as the code, there isn't any other javascript in it.

There may be a larger problem because of the frames. There are 3 pages - 1 is the parent and when you click on something, it opens 2 which has 2 frames. The left is a listing of events and the right shows the info for that event. If you click delete, it opens yet anothe page which has the javascript that prompts your reason for delete. When you click enter, it closes the asp page (page 3) and refreshes the menu (left frame) of page 2 reflecting no information for that event. However, the right side of the frame still shows the information for that event as it has not been refreshed. The reason I would like it to close is because the right frame has a 'Save' button on it unless it is refreshed. If they click Save, it saves the record all over again so I am envisioning a 'save record' 'delete record' cycle for some of the users of this app. So, I figured it would be best to just have page 2 close and once the delete reason is entered then the user will be returned to the main page (page 1).

Is there a better way to do this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top