javascript

Making parent link unclickable in a drop-down menu with jQuery

Hello everyone! I have a drop-down menu that are dynamically added through WordPress. It looks like this: Pictures Sea Forest City "Sea", "Forest" and "City" is categories with "Pictures" as parent category. My question is: How do I make the "Pictures" category unclickable? I did this with jQuery: $(document).ready(fu...

(E)BNF Parsing to XML

Is there any (E)BNF parser out there which is able to generate XML trees of the AST? Rephrasing: what is the quickest way to compile an (E)BNF defined language into some sort of XML? Bonus: Using Javascript :-) ...

Rails text_field default value disappear on click (and dimmed)

These text fields look great and are common on web 2.0 sites like Facebook. Basically instead of labeling the text field, you can save space by putting the label inside the text field. Typically the text is dimmed in color a bit, and when the user clicks in the text field the default value disappears, and the color switches to black or...

Fading script will not work in IE?

Hi, I'm pretty new to Javascript and have been trying to achieve some fading effects on a website. I've managed to hammer together the effects I want and everything's working fine on Firefox & Safari. However IE doesn't like it. The first script to change the background colour works but the second script to fade in the content does nothi...

How to handle ESC keydown on javascript popup window

I have a javascript window.open popup, and I want the popup to close itself when the user presses the ESC key. I can't figure out how to hook the keydown event (and on what object?) so that I can catch the ESC key. I'm using jQuery. ...

Add an image to count down script

I want to add an image next to "Click here to Download" Meaning when count down is over it should look something like this: Click here to Download and this image should be beside it http://svastara.info/.s/img/icon/download1.png <script type="text/javascript"> <!-- var count=30; var obj; window.onload=function() { obj=document.getEleme...

Waiting x milliseconds after an event, recheck and trigger

I currently have a jQuery.event listener, which once triggers will display an otherwise hidden element (a rollover, basically). However, is there a way I can get jQuery to wait a few milliseconds, recheck to ensure the mouse is still over the element and then trigger the .show() event if it is? I currently have: $("#who-mousearea").mo...

alert() prompt - Checkboxes

With alerts you can have text inputs. I was hoping you could put check boxes in. Is this possible? http://www.w3schools.com/JS/js_popup.asp ...

Time things with Javascript

How can i time how much time passes between 2 events with javascript? like, to the millisecond? ...

OpenID: Single User Interface Supporting Both Email/Password and OpenID

I like the idea of OpenID, I really do. But few of my target users have even heard of it - yet. If I want to offer OpenID as an option, my only choice would seem to come down to offering BOTH email/password authentication AND OpenID. I've seen several sites that use this combination and the idea seems unappealing to put it mildly. Placi...

Javascript: How to get all elements that are highlighted

I want to get all of the elements in a user highlighted area. The problem is that I don't know how to traverse to different parts of the DOM, when the elements are on a different part of the tree. My code so far can only get the elements off the startContainer of the selection range. Do I need some sort of recursion? Here is my code:...

Javascript not working as expected, why?

Hi, I have javascript to set equal column heights of two divs contained by a parent div. Somebody even coded an working example that works (mine doesn't). What I have found is that it IS setting the height of the container which contains the two divs I intended to set. Why is my script setting the container height rather than it's ch...

Utility to auto insert semicolons in javascript source code?

The question is pretty self explanatory. I'm working with code from multiple developers. Some of whom are inconsistent in their use of semicolons, and I just want them after every line for consistency (and to prevent any masking of errors). I use Aptana to format my source code, but it won't add semicolons for you AFAIK. Thanks. ...

Facebook app JS API with iFrame example?

I have a Facebook app set as an iFrame, pointed to a file on my own server. I followed http://wiki.developers.facebook.com/index.php/JavaScript%5FClient%5FLibrary and the first example, but nothing shows up in the Error Console on Firefox or the textarea. The other non-Facebook stuff in this file works. What's a simple example using the...

How to show popup message box in ASP.NET?

Work on C# VS 2005 AJAX enabled web. I want to show a pop up message on my web page. In my desktop application I write the following code to show a message: MessageBox.Show("Data Saved Successfully.", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); I want this kind of message. Where i can set message icon, Message Header, M...

Apply class to element if div is hidden or visible.

Check out my example here: http://timkjaerlange.com/foobar/test.html I'm currently trying to apply a class to a header based on the visibility of a div on the page. This is my markup: <a href="#">Toggle visibility!</a> <div></div> <h1 class="one">If the box is hidden this headline should be italic.</h1> <h1 class="two">If the box is...

Moving elements to top/bottom in sortable_element

Hi! I,m using sortable_element to sort some list with dragging and dropping, but I would like to have also some top/bottom buttons to move elements. Is there any javascript function that would act as if I dragged some element to the top/bottom of the list? ...

I want to add JavaScripts in JavaDoc

/** * <div class="en">Documentation in English</div> * <div class="nl">Documentatie in Nederlands</div> */ public void myFunction() {} Subsequently edit the CSS of the JavaDocs so that the user can switch languages, e.g.: div.en { display:none; } div.nl { display:block; } How to add javascripts in JavaDoc? ...

click event of parent triggered

Problem is solved, i made another stupid mistake in my code... sorry, thanks example: <div id="window1Header" class="windowHeader"> Window 1 <a id="min1" class="minimize">[-]</a> <a id="max1" class="maximize">[+]</a> </div> <script> $(function() { $(".windowHeader").mousedown(function () { $(this).parent().css({"border"...

Javascript: How do fix W3 Validation Error caused by &

Hey Is there any way to fix the error that a JavaScript & causes in w3 validation? The problem is that i have to use && in a if statement and these two &&'s causes errors in w3 validation. EDIT: Same problem with "<" and ">". ...