How to pass parameters in this js?


< html >
< head >
< script >
function myFunction (data)
{
alert ("data");
}
< / script >
< / head >

< body >
< button onclick= "myFunction ()" > Click here < / button >
< / body >
< / html >

this js is written in the html code, and I"m going to pass the data into the js function in the html code from the imported js file.
what should I do? Due to special requirements, this js should be written in html, but the data does not know how to transfer from the external js.
Thank you.

Jul.15,2021

this depends on the specific situation.
if there is only a limited amount of data sent from js, it can be encapsulated as a parameterless call entry

. In addition, I think the problem is that since you are going to write HTML, where does your dynamic change come from? Whether it can be written to a global variable, which can also be called without parameters by accessing the global variable.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35ced-2bfd0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35ced-2bfd0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?