Skip to content
Advertisement

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,

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),

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:

Read Facebook Application Cookie from JavaScript?

(I’m fairly certain the answer to this question is quite simply “no” but I figured I’d ask in case anybody here has found a clever solution/workaround in the past.) Using the PHP code provided as an example for simple Facebook development, one can see how it reads in the cookie to get the necessary values to place in the JavaScript

How to trim a file extension from a String in JavaScript?

For example, assuming that x = filename.jpg, I want to get filename, where filename could be any file name (Let’s assume the file name only contains [a-zA-Z0-9-_] to simplify.). I saw x.substring(0, x.indexOf(‘.jpg’)) on DZone Snippets, but wouldn’t x.substring(0, x.length-4) perform better? Because, length is a property and doesn’t do character checking whereas indexOf() is a function and does character

Advertisement