javascript

Cannot execute a javascript script file from windows explorer or the DOS prompt

I'm a C++ developer and want to install the WTL appwizard to Visual Studio 2010. To do this, I must run a .js script file. I recently tried out Aptana IDE and it's clobbered the .js file association, and now I cannot execute this .js script file. How can I execute .js script files again? ...

Persisting div toggle state with cookies

Hello, Using the code sample below, how could I utilize the jquery cookie plugin so that the toggle state of each div element persist beyond the browser session. Thanks. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery...

Using haml or erb code in ModalBox causes afterLoad callback to not get called

I open a ModalBox with: =link_to_function "Add", "Modalbox.show('appt', {title: this.title, width: 600, height: 400, afterLoad: function() { alert('Content loaded') } });" This loads a haml file. When the haml file contains certain code, the callback never gets triggered. The same actually happens with .erb files as well. For example...

javascript string manipulation

I have a long string with Headers and Sub-headers. Every header is supposed to have a sub header, but the string pre-processing, does not. I need to manipulate it in such a way that every header has a Sub-header. Every header that does not have a string has a reference point under different header. The header missing the subheader need...

Insert html via .before() jquery

Right i'm trying to insert some basic html before a div like this <script>$("div#header").before("<div class="test">test</div>");</script> However nothing appears, but when i try the jquery example <script>$("p").before("<b>Hello</b>");</script> it works, what i'm i doing wrong? Thanks ...

Can I use SproutCore without Ruby?

SproutCore is said to be a JavaScript framework, so how to use it entirely without Ruby (actually with PHP or Java) on server side? ...

How do I make a JavaScript animation play at the same speed on all browsers on all systems?

I have a function that calculates the next frame in an animation of various objects moving in both X and Y axis [ I call it frameRender() ] and a function that applies that resulting frame to the objects [ I call that frameDisplay() ]. The objects don't just move from point A to B, they move constantly, always receiving new target coords...

Class Casting in MooTools?

I have a class and two other classes extending it. I essentially want to be able to make an object of the main class and then be able to convert/cast it into the appropriate subclass depending on some conditions of the object itself. Alternatively, I could replace the instance of the main class with an instance of the subclass. Are eithe...

sleep() in Javascript

Suppose I want to block Javascript execution for certain time for some weird reason, how can I do that. There is no sleep() in JS. Pls don't say do a while() loop because that's bad. I can do a window.showModalDialog and put a window.close in the modal dialog with setTimeout of very small time so that the user doesn't notice the dialog. ...

Get the selected element's HTML Tag in JavaScript

I know you can do this, but every time I Google it I get how to select all elements of a certain tag. So, e.g.: alert($('#my-wrapper').someJSMethod()); {...} <div id="my-wrapper"></div> Would alert "DIV" actually. I'm selecting elements with jQuery by the way. ...

Can this Flash tool be done with JavaScript (jQuery)/HTML5/CSS3?

This is a tool which builds a bicycle visually from components the user selects. What do you think, can this be done with HTML5/JavaScript (jQuery)/CSS3? What do I need to know to start? What do you think the trickier parts will be? http://www.hotcards.com/bikes_102/bikes.html ...

HTML Radiobuton values in ASP.NET

I'm having some real problems with a group of HTML Radiobuttons when I try to pass the selected values back and forth between JavaScript and ASP.NET. <input type="radio" id="radio1" name="markerSel" value="1" checked=true /> <input type="radio" id="radio2" name="markerSel" value="2" /> <input type="radio" id="radio3" name="markerSel" va...

Facebook type popup drop down lists recreate (image attached)

Hello , Was hoping someone could point me in the right direction, perhaps to a tutorial on how to create these popup drop down lists like facebooks who liked this link.. I'm assuming its jquery? Any ideas guys? ...

Validate JavaScript syntax in IDE (Editor)?

Are there any JavaScript editors that can validate JavaScript syntax on the fly? Things like missing brackets, etc. ...

Can Javascript be Bootstrapped?

Will Javascript on the rapid rise and it being adapted for all sorts of things, my question is: Can Javascript be bootstrapped? More specifically, would a JS parser written in JS be fast enough to be useful at all? What are the design decisions that go into deciding whether or not to bootstrap a language? This questions comes after see...

Create a javascript file to have <object> or <embed> tags in it for use in various html pages

I have more than 200 pages with the same <object> or <embed> tags for. I need to have a .js file to have this repeatative information in it. This is the tag is repeating in all 200-300 page: <OBJECT width="720" height="540"> <PARAM NAME="Src" value="../pdf/sign-va.pdf"> <embed width="720" height="540" src="../pdf/sign-va.pdf" ...

In jQuery, how does prepend() work on a children() function?

I am a little confused on how prepend acts towards a children function. image.canvas.children('.image-pinpoint-view').prepend(this.area); where would this.area appear? ...

JavaScript: Key Event Handling after Assigning a Focus

So, I just learned html/css/javascript last week, so I am not too savvy with it, and I am currently working on an app that uses the keyboard for navigation. Anyways, I needed to create custom pop-ups and am running into a problem when trying to close them. To open the pop up, the user needs to hit 'ENTER' while selecting a menu item....

How do I tell whether a browser is on a touchscreen device with JavaScript?

I know this is a bit of perennial question, but here goes: I want to know whether the device my site is being accessed with is a touchscreen. That means phones and iPads, of course, which are individually detectable, but also other touchscreens that may well be running flavors of Windows. Any chance of determining the presence or absence...

How to use jQuery to download zip file which directly ouput from server?

I have a php script that will generate zip file. header("Content-type: application/octet-stream"); header("Content-disposition: attachment; filename=random_name.zip"); echo $zipfile->file(); The filename is random and the server script doesn't even come with a return-file-uri function. So my question is that how jQuery can handle thi...