Problem with onchange event and apex

Hi all.

I have problem with this onchange event:

PHP Code:
If B value contains apex character ( apostrophe ) , this script presents javascript error.

For example:

1) upload.asp?SULMONA%20CITTA' generates javascript error;
2) upload.asp?SULMONA%20CITTA not generates javascript error;

Can you help me?
Kind regards