sounds like your talking javascript, one way to do this would be to have when onfocus have it call a function that passes the name of that form.
like this isnt correct js syntax but example
function jscaller(formvariable)
{
then in this function you have formvariable the name of the form and you can do whatever you want with it.
}
onfocus(jscaller("Form1"));
hope this helps else seek javascript forum 😉
if your talking about something php and im way off then disregard this post and repost with more info