Can I automatically switch user input method from fullwidth katakana to halfwidth hiragana when I focus in an input using javascript or PHP?

(1) I have a form of html inputs, some of which are allowed to type in halfwidth hiragana, the others are allowed to type in fullwidth katakana.

(2) Now, I need a way to automatically switch user keyboard input method between halfwidth hiragana and fullwidth katakana when user focus in the input in (1)

Is this possible or not?