Is there a way to check if JavaScript is enabled with PHP? If so, how? Answer No, that is not possible, because PHP is a server side language, it does not access the client’s browser in any way or form (the client requests from the PHP server). The client may provide some meta info through HTTP headers, but they don’t
Tag: javascript
Adding to browser context menu?
Is it possible to add item to the default browser right button click menu? Answer One option is to replace the context menu with your own JavaScript triggered equivalent. Firefox implemented the menu element where you can add to the existing context menu. It was also implemented in Chrome behind a flag. Unfortunately this feature has been removed from the
How can I write a simple JScript input/output program?
I’m planning on using JavaScript to enter an informatics competition (BIO) tomorrow. However, I can’t rely on the examiner having a browser with a decent JavaScript engine, so I was hoping to use Microsoft’s JScript instead. However, the documentation is, quite frankly, crap. Can someone post some example code that reads in a line of text, calls foo(string) on it,
get all the elements of a particular form
The above code gets all the input elements on a page which has more than one form. How do I get the input elements of a particular form using plain JavaScript? Answer
Checking if two Dates have the same date info
How can I check if two different date objects have the same date information(having same day, month, year …)? I have tried “==”, “===” and .equals but none seems to work. Answer You can use valueOf() or getTime():
What is the DOM and BOM in JavaScript?
What is the DOM and BOM in JavaScript? If someone could explain these in layman terms it would be great! I like to get a deeper understanding of these. Answer The BOM (Browser Object Model) consists of the objects navigator, history, screen, location and document which are children of window. In the document node is the DOM (Document Object Model),
How to print selected div instead complete page
I have two divs: div1 and div2. Maintaining the original css styles applied to the div2 element being printed. I don’t want to print content inside div1 but only the inside of div2. How to print? Answer Try this
Loop through a date range with JavaScript
Given two Date() objects, where one is less than the other, how do I loop every day between the dates? Would this sort of loop work? But how can I add one day to the loop counter? Thanks! Answer Here’s a way to do it by making use of the way adding one day causes the date to roll over
CSS2 cursor not displaying “hand”
I’m following the standard of W3C here http://www.w3.org/TR/CSS2/ui.html and here http://www.quirksmode.org/css/cursor.html#note. However, the element isn’t displayed the hand when mouseover. Please help. When viewing with IE9 and mouseover, it doesn’t change the cursor into the “hand”, but it’s just the regular arrow instead. Please advise. Thanks! Answer It should be cursor: pointer; alone because hand is a proprietary value only
getElementById() wildcard
I got a div, and there i got some childnodes in undefined levels. Now I have to change the ID of every element into one div. How to realize? I thought, because they have upgoing IDs, so if the parent is id=’path_test_maindiv’ then the next downer would be ‘path_test_maindiv_child’, and therefore I thought, I’d solve that by wildcards, for example: