IFrameElement.onclick#
- IFrameElement.onclick(func_or_name, *func_args, quotes=True, return_itself=False)#
Creates the HTML event attribute
onclickand adds a Python function to it.If you want to add JavaScript code instead of a single function, use Element.set_attr method instead.
Warning
If you added a Python function, users might be able to call this function from the client-side. Choose wisely the functions you add.
- Parameters:
func_or_name (Callable or str) – The Python function to be called when the event is triggered. If the Python function itself is added, the function will be automatically added to the parent Page. However, if the function name is added, you need to add the Python function itself to the parent Page manually using the method Page.add_function. The func_or_name parameter can also be a JavaScript function. In this case, there is no need to use the method Page.add_function.
func_args – The arguments of the function. Each argument will be automatically converted to a string.
quotes (bool, default = True) – If
True, each argument will be surrounded by double quotes.return_itsef (bool, default=False) – If
True, the first argument of the function will be the element itself.
See also