0

I'm having problems with a JavaScript function not firing and I can't figure out why not.
I'm opening a pop-up window which needs to pass some variables back to the opening window. I've used this code elsewhere with no problems and I've copied it and changed some of the details and now it doesn't work. It's probably going to turn out to be something so stupid but I just can't see it.

Pop-up window code:

function sendValue (employerseq,employercode,employername)
{
		var selvaluea = employerseq.value;
		var selvalueb = employercode.value;
		var selvaluec = employername.value;
		window.opener.myfunc(selvaluea,selvalueb,selvaluec);
		window.close();
}

Using alerts I can see that the correct variables have been passed into the funcion and are being assigned correctly. It doesn't seem to want to trigger the function in the opener window myfunc.

Opening Window code:

function myfunc(employerseq,employercode,employername)
{
	alert('in my function');
	window.document.getElementById('employer_seq').value = employerseq.value;
	window.document.getElementById('employer_code').value = employercode.value;
	window.document.getElementById('employer_name').value = employername.value;
}

It doesn't even trigger the first alert instruction in the function.

Can anybody see what the problem is?

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by chillipit
0

I just don't get it. I left my code unchanged and used CTR+SHFT+R and now the code is working. Really frustrating.

0

It does seem to be a problem with the cache. Even after clearing all the history it still wouldn't work, but CNTR+SHFT+R seems to have done the trick.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.