javascript

What is the most efficient way to create HTML elements using jQuery?

Hi guys, Recently I've been doing a lot of modal window pop ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelmingly been along the lines of: $("<div></div>"); However, I'm getting the niggling feeling that this isn't the best or the most efficient method of doing th...

JSCocoa and the iPhone

Now I have a stack of free time on my hands, I wanna get into iphone dev fo real. But Objective C scares me (a bit). It feels I'm going a bit back in time. I say this because I've spent the last 8 months coding in C++. JSCocoa looks awesome, but does this actually work on the iphone? What would need to be done to get this working on t...

Why is it not advisable to use JavaScript in JSP?

Why is it not advisable to use JavaScript in JSP? One rationale that I can think of is turning off the feature in browser would stop the code from executing. Is there any other reason behind this? ...

Online exam web application

I am developing an online exam using JSP/Servlets which is nearing completion. I'm planning to add timer function for the entire exam that shows elapsed time in minutes. How do I implement this with a fool-proof technique to implement this, because using javascript would mean that the user can turn off the feature in the browser. Any hel...

What's the best way to calculate date difference in Javascript

I doing a function in Javascript like the VisualBasic DateDiff. You give two dates and the returning time interval (Seconds, Minutes, Days, etc...) DateDiff(ByVal Interval As Microsoft.VisualBasic.DateInterval, _ ByVal Date1 As Date, ByVal Date2 As Date) as Long So what's the best way to calculate the difference of Javascript Dates...

Scoping issue in Javascript

Hi All, I need to have some information about the Scoping issue in Javascript. I know that it spports lexical(static) scoping, but, does not it support dynamic scoping as well? If you know anything about the scoping in Javascript, would you please share them with me ? Thanks ...

The best way to change the innerHTML of a certain type of Elements

I've a HTML page with several Div's that will show the time difference between now and each given date. <div class="dated" onEvent="calculateHTML(this, 'Sat Jun 09 2007 17:46:21')"> 30 Minutes Ago</div> I want that time difference to be dynamic (calculated to all elements when the page loads and also within a time interval) So, my id...

Using fadein and append

I am loading JSON data to my page and using appendTo() but I am trying to fade in my results, any ideas? $("#posts").fadeIn(); $(content).appendTo("#posts"); I saw that there is a difference between append and appendTo, on the documents. I tried this as well: $("#posts").append(content).fadeIn(); I got it, the above did the trick!...

is there a way to read binary data into javascript?

I would like to inject binary data into an object in javascript. is there a way to do this? i.e. var binObj = new BinaryObject('101010100101011'); something to that effect. any help would be great ...

How can my javascript determine if it was called by WScript or a browser?

I am trying to write a javascript program that can be called from either WScript or a browser (embedded in html). Many javascript functions are independent of the type of caller, but not the debugging functions, such as "window.write" or "WScript.alert". I am aware that javascript functions can determine the name of their caller, but n...

Controlling a Flash Player using JavaScript

I would like to be able to control a flash movie stream using JavaScript in the same pages as the flash component including: Play and Pause stream Change Stream I can already load the player and set the flash args, but I don't know how to interact with the player once the stream has started. Is this possible without modifying the SW...

In Firefox, can I figure out which random word in a div full of words the mouse is hovering?

For example, if I have: <div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur urna felis, convallis quis, placerat in, elementum quis, libero. Nam quis lacus. Vivamus rhoncus quam et metus. Praesent et velit eget sem vestibulum volutpat. Integer sed risus. Integer quis libero id diam bibendum luctus. Donec eleifend. C...

How to do JavaScript object introspection?

What to do when after all probing, a reportedly valid object return 'undefined' for any attribute probed? I use jQuery, $('selector').mouseover(function() { }); Everything returns 'undefined' for $(this) inside the function scope. The selector is a 'area' for a map tag and I'm looking for its parent attributes. ...

Mashup - how to begin..

I have an application. I am looking to create a mashup script that can be shared to other sites to use my application. Had couple of queries.. API - What would be best.. using HTTP or some other webservice script - whats the best way to pass data to the api? which scripting would you recommend? Thanks.. ...

V8 JavaScript Engine on Windows (MinGW)

The build instructions of V8 JavaScript Engine mention only Visual Studio 2005 and 2008. Has anybody been successful with MinGW on Windows XP/Vista? ...

What javascript library do you recommend to display/popup screenshots on a webpage?

I've seen some nice screenshot popups around the web, do you know of any library to do that? I could write my own, but... if there's something free I can save time. Thanks! ...

Disable JavaScript keypress events in iframes

How do I disable the support for JavaScript keypress events in iframes? I need keypress events disabled only in specific iframes, so doing a catch-all-events-and-make-em-do-nothing solution is not an option. ...

Always use jquery selectors or cache them in variables?

jQuery selectors are wonderful, but I sometimes I find myself typing them over and over, and it gets a little annoying. $('#mybutton').click(function() { $('#message-box').doSomething(); $('#message-box').doSomethingElse(); $('#message-box').attr('something', 'something'); }); So often I like to cache my objects in varia...

Changing the stylesheet of a nested page at runtime

First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS and JavaScript. I gather that in XHTML, the correct way to have a nested page is as follows (instead of an iframe): <object name="nestedPage" data="http://abc.com/page.html" type="text/html" width="500" height="400" /> If I have a nested page like that - is it ...

Programming coordinates-based game, like dots or checkers

I'm looking to learn some fundamentals on cartesian geometry or coordinates based game programming. Platform is irrelevant, although I'm most proficient in JavaScript, C, Objective-C. Ultimately being able to create something such as dots or checkers would be ideal. The idea is for me to learn how sprites work and how pathing works progr...