working on a mini page for some homework and I’m stuck! What we’ve been told to do it to pull localStorage variables from a fake “registration” page we’ve made (which gets it’s information from a user’s choice of three radio buttons) and use that information to alter …
Tag: javascript
Capturing jQuery form submit event
I don’t know what is wrong with that, because I was following at every step the tutorial from jquery.com regarding the form submit event. My Javascript: [Ofc. latest jQuery library is included]. Have also tried with the $(document).ready() event: Here is my HTML form code: So, regarding the above Javasc…
How get the value of multiple checkboxes in javascript
I used checkbox in two items now I can get the value of the second group of checkbox. The first group of checkbox I use: Then How can i get the value of selected checkboxes, in each group it is only allowed to select 1 checkbox. I just need the javascript function Answer You can use this following codes to
How to get a property with get/set to serialize with JSON.stringify()
I have the following scenario: I was hoping that I can somehow set a toJSON method on the property “x” in the defineProperty call, but that didn’t work. Any help would be appreciated. Answer This is what worked for me: Note test is not a prototype definition and enumerable has to be set to t…
How to Make a Picture rotate Continuously? [closed]
It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago. ) I have a star ima…
Javascript “Not a Constructor” Exception while creating objects
I am defining an object like this: I then try to create an instance like this: but this exception is thrown: What could be wrong? I googled around a lot, but I still can’t figure out what I am doing wrong. Answer The code as posted in the question cannot generate that error, because Project is not a use…
How to play a notification sound on websites?
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 …
Convert date to another timezone in JavaScript
I am looking for a function to convert date in one timezone to another. It need two parameters, date (in format “2012/04/10 10:10:30 +0000”) timezone string (“Asia/Jakarta”) The timezone string is described in http://en.wikipedia.org/wiki/Zone.tab Is there an easy way to do this? Answe…
Detect keypress combination series with Javascript
For the Easter holiday, I’m wanting to have a little surprise “Easter Egg Hunt” on a site I develop for. Two of these five Easter Eggs I’m hiding will be keypress ordained. This won’t be like a “Press CTRL and TAB at the same time” type deal but will be a “Pres …
Get data from fs.readFile [duplicate]
This question already has answers here: Why is my variable unaltered after I modify it inside of a function? – Asynchronous code reference (7 answers) Closed 6 days ago. Logs undefined, why? Answer To elaborate on what @Raynos said, the function you have defined is an asynchronous callback. It doesnR…