When a certain event occurs, I want my website to play a short notification sound to the user. The sound should not auto-start (instantly) when the website is opened. Instead, it should be played on demand via JavaScript (when that certain event occurs). It is important that this also works on older browsers (IE6 and such). So, basically there are
Tag: html
HTML5, canvas, and strokeRect: some lines too narrow and blurry
A stupid simple canvas usage: Yields a rectangle with narrower lines along top and left: Why does this happen? Do I need to offset with padding? It’s annoying. Answer 2 things. First, odd lineWidths (1, 3, 5, …) will never apply cleanly with drawn on integer pixel values. This is because X and Y refer to the space between pixels
JavaScript get word before cursor
Okay, I’ve been looking all over the web to find a solution but I couldn’t find one, is there a way to get the word before the caret position in an editable div so a bit like: This should return the word “some”… I don’t know if this is possible, I would be glad for any help, thanks :). Answer
Check if at least one checkbox is selected PER questio.n
Here we go again , searched and tried myself but none of the online examples are not the same as in my case. I have 2 radio based question and other 22 with checkboxes. My question is how to check if at least 1 checkbox/radio is selected on each question and display javascript alert in case they are not EG
How to reset/uncheck radio button onclick event?
I have 2 radio button with 2 group. The structure is like this Main Radio 1 Main Radio 2 Under Main Radio 2, there’s two more sub radio button. Main Radio 1 Main Radio 2 Sub Radio 1 Sub Radio 2 What am I doing is, in default stage, it will only show Main Radio 1 and Main Radio 2
How to control animate function on button click?
I have two divs named “arrow” and “inner”. I am trying to control the animate slide function when the div is clicked but have been unfortunate. The issue is noticeable when clicking very fast on the “arrow” div after user stops clicking the div is still sliding. I set the animate function under a small delay but I still experience
HTML5 – passing Canvas between files
I have two html files, say 1.html and 2.html with 1.js and 2.js referenced javascripts. In 1.html I have a Canvas object with drag and drop functionality, so that i use drawImage method for adding additional images to the canvas. When I am finished with adding images on 1.html, i save the canvas to the localStorage. Shortly it would be
Disable scrolling on “
Is it possible to disable the scroll wheel changing the number in an input number field? I’ve messed with webkit-specific CSS to remove the spinner but I’d like to get rid of this behavior altogether. I like using type=number since it brings up a nice keyboard on iOS. Answer Prevent the default behavior of the mousewheel event on input-number elements
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 numeric parameter, I assume that it has
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 animation.or is there any other