javascript

Javascript drop down menu widget

I have a menu consisting of an <ul> in a Web CMS. I want several menu items to have sub-items that are displayed in a dropdown list. These sub-items are <ul>s as well. This is basically easy to do with a few lines of CSS and Javascript, but I am looking for a ready-made Javascript solution that helps me handle the following: Deal wit...

How to use Ext JS for role based application

Hi all, I am planning to use Ext JS for a large application. The application's features are role based. When user login, they only see menu and screen features related to them. My server side technology will be Java & JSP. To solve this I have two ideas.. 1. Create Ext JS related javascript dynamically after the user login using s...

How to get 'text' out of <p>Text<input type="... </p>

Hello, I can't get this to work in IE: This is what the HTML code looks like: <p class="red">Red: <input type="text" id="red_input" value="0"></p> id is in this case: document.getElementById('red_input'); I want to return ONLY the word 'red'. It works great in FF, but not in IE. function error(id){ var prnt = id.parentNode, ...

uncaught exception: Syntax error, unrecognized expression: #

Hi all, I get this error on a .click() event in jQuery. I see it in Firebug. I use the latest version, 1.3.2 (min) The click fires an $.ajax() request for a Form in my website. I asked google about this and all he knows is "%" or "[@]" as unrecognized expressions, nothing about the "#". here is a bit of my code: $("form#buyForm #su...

jQuery UI sortable/draggable - with palette (copy/remove instead of moving)

I've got a simple setup using jQuery UI's default sortable/draggable functionality. I now need to add a 'palette' which will will be a list of all items in all lists (and some that may not be in any lists). Like this: <ul id="palette" class="ui-sortable"> <li class="used">A</li> <li>B</li> <li class="used">C</li> <li class="used">D...

Redirect to new blog using jquery or javascript

I closed my old blog so I redirect our old blog to our new blog but if any user comes from the old blog then he can't watch our video in our blog.. i used <script language="javascript" type="text/javascript"> window.onload = function java() { window.location = "http://anirudhagupta.blogspot.com"; } </script> But he r...

Change Attribute Every Second

I want an image to change every second. I'm having trouble with setInterval. Could someone post a quick snippet on how to do this This is what I came up with. var images = 'images/image_*.png'; for(var i = 1; i <= 5; i++){ function changeImg(){ var path = images.replace('*', i); $('img').attr('src', path); } setIn...

Getting input from user, building a URL and then opening it in current window

Hi, I need some javascript that will provide a textbox for the user to supply a key, append a parameter to a URL and then open it in the current window. Simple, I'm sure, but I'm new to Javascript. Any help would certainly be appreciated! Thanks! ...

whats a good tool for finding syntax errors in my javascript code?

I'm trying to use firebug to walk through my code, but there's a syntax error somewhere and firebug is struggling with it. Are there any good tools that will scan my javascript for sytax errors? Thanks in advance for your help! ...

Are equal timeouts executed in order in Javascript?

Suppose I do setTimeout(foo, 0); ... setTimeout(bar, 0); Can I be sure foo will begin executing before bar? What if instead of 0 I use a timeout of 1, 10, or 100 for bar? Simple experiments show that in the case of equal timeout values the timeout targets are executed in the same order as the setTimeouts themselves, but is it safe...

Value is the variable name instead of the contents of the variable

I'm trying to initialise some data values dynamically inside a javascript object, but when I create a concatenated string to pass along, the actual key stored is the variable name, instead of the value inside it. Example: projects.init = function(){ for (var i = this.numBoxes - 1; i >= 0; i--){ var toInject = "item"+i; this.datas[...

Doubt about "Put SCRIPTs at the bottom" advice

I have read the advice about putting SCRIPTs at the bottomm (e.g. http://stackoverflow.com/questions/383045/is-put-scripts-at-the-bottom-correct) and I understand the concept. However, I have a doubt. If I have an OnClick even that calls a JS function that will fail if the javascript include file has not loaded. I could work around thi...

What tool do you use for debugging Javascript?

I've notices I'm not capable to debug correctly js. I'm only using alert() as a spread sentences technique but I need something better. So... which tool do you use? ...

jQuery UI makes my tabs reload every time I click them

Hi, I'm creating a web application which loads tabs using AJAX. My problem is that if I have multiple tabs, jQuery reloads a tab every time I click it again (after visiting another tab). Here is my code: index.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd...

Detect when user clicks link, but aborts

I am working on a Web CMS. When the user clicks on a link to move to a different page, or submits a form, I want a "please wait" animated GIF to show up in the top right corner to symbolize that loading is in progress. However, the user can cancel loading of the new page in their browser, for example by pressing the "cancel" button or E...

Replace Helvetica Neue with a different font in firefox.

Is there a way to replace the font 'Helvetica Neue' with 'Verdana' in firefox via the userchrome.css, usercontent.css, or user.js? I find this font extremely hard to read without zooming the content. Thanks. ...

How to append DOM Element into an empty element in JavaScript?

I have bunch of objects that return a DOM-tree that I then use to append to an element. For example, var elem = document.createElement('div'); elem.appendChild(callSomePrototypesMethod()); elem.appendChild(callSomePrototypesMethod()); elem.appendChild(callSomePrototypesMethod()); and I will eventually end up in something like: <div> ...

setTimeout inside for loop

Hello. I want a string to appear character-for-character with the following code: function initText() { var textScroller = document.getElementById('textScroller'); var text = 'Hello how are you?'; for(c = 0; c < text.length; c++) { setTimeout('textScroller.innerHTML += text[c]', 1000); } } window.onload = init...

Creating a DOM NodeList

I'm implementing all of the optional E4X features described in ECMA-357 Annex A and I'm having trouble implementing domNodeList (§A.1.2 and §A.2.2). How would I create my own NodeList object? Even if I create a new XMLDocument and append every domNode() representation of the nodes in an XMLList, I still don't see how I could create a No...

JavaScript Charts API: Flot jQuery Plugin OR Google Visualization ?

Hi, I am looking for a charts library to be displayed on a website. I will use intensively this library (for area, line and bar charts mainly), so I prefer to secure my choice before starting implementing. The list of website chart libraries that I have initially considered are: Plotkit Emprise JS Charts Sparkline Protochart gRaphae...