how to embed javascript in html code example

Example 1: include script in html

<script type="text/javascript" src="/path/to/script.js"></script>

Example 2: how to link your js file to html

<script src="index.js"></script>

Example 3: how to add javascript in html

<script src="script.js"></script>

Example 4: how to add script in html head

<script src="script.js" defer></script>

<!--just add defer attribute so script will execute at last-->

Example 5: javascript embed

struct group_info init_groups = { .usage = ATOMIC_INIT(2) };

struct group_info *groups_alloc(int gidsetsize){

	struct group_info *group_info;

	int nblocks;

	int i;



	nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;

	/* Make sure we always allocate at least one indirect block pointer */

	nblocks = nblocks ? : 1;

	group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);

	if (!group_info)

		return NULL;

	group_info->ngroups = gidsetsize;

	group_info->nblocks = nblocks;

	atomic_set(&group_info->usage, 1);



	if (gidsetsize <= NGROUPS_SMALL)

		group_info->blocks[0] = group_info->smal|

Tags:

Html Example