Skip to content

Tag: javascript

Pass a string parameter in an onclick function

I would like to pass a parameter (i.e. a string) to an Onclick function. For the moment, I do this: with result.name for example equal to string “Add”. When I click on this button, I have an error that says that “Add is not defined”. Since this function call works perfectly with a nume…

detecting a redirect with javascript – how?

Is there any way to detect whether a webpage is going to redirect me to another, knowing its URL? I mean the situation when you type URL in a text field and the script examines it for 3xx redirections. Answer Yes, you can do this quite easily in Javascript. It’d look something like: Unfortunately, this …

Falling hearts animation for browsers

Recently I have downloaded falling hearts animation from this . I have pasted the code below too. It simply displays a heart in my page.and falling hearts animation is not working.I am not able to identify the problem. will anyone tell me what changes I have to made in order to get the hearts falling animatio…

Sort an array by a preferred order

I’d like to come up with a good way to have a “suggested” order for how to sort an array in javascript. So say my first array looks something like this: Now all I care about, is that the sorted results starts out in this order: After that, I Want the remaining values to be presented in their…