this absolutely can be done. what is not working?
if you are using firefox, take peek at the javascript console. if it's not available from one of the menus, you might want to reinstall and check the installation options for something like 'javascript development kit' or something like that.
if you're using IE, then make sure the status bar is visible and look for the javascript error alert in the bottom left corner of the browser window...if instead of an IE icon it looks like a yellow triangle error flag, then double click it.
this will give you more information about what is breaking down.
chances are if it doesn't work then your window/parent/opener reference might be wrong or more likely, this part is wrong:
document.getElementById('cv').search.value = val;
i don't recall any document elements I know of having a 'search' property or method.
i also find it helpful to put alert statements in my functions to make sure they are in fact getting called.
if you need more info about what the correct object or window references should be, try googling 'DOM'
EDIT: also, this isn't really a PHP question but rather a javascript or DOM question. You'd get better results at a javascript forum.