javascript

Need to get a path location via a web page

In firefox 2 I was able to get the path using Browse - I use the path in our project to then write out files to that location. So now that browse does not get the path, does anyone know a way for a user to go to a directory and have the path returned via a web page so I could pass that along to the server for processing? execCommand do...

Javascript injection

I need to solve a problem with javascript injection in a form textarea and fields script type='text/javascript' window.location='http:site.com'; /script or a href='javascript:...' or form action... or input name... but i preserve some html tags for example a, b, ul... is this possible? ...

extjs: how can I add event handlers to a component in its raw object form (xtype)

I have an extjs component in its raw object type, for example: var x = { xtype: 'button', text: 'Delete', handler: whatever, more:config, more2: config2}; Now I want to add some listener to x. In my scenario I don't have access to the x object before or right after it is created. I just want to add an event handler ...

Testing js.erb files in rails

Hi, I recently had a look at the awesome Blue Ridge Javascript testing framework to test javascript on my rails app. But i was wondering if anyone knew how to test the javascript view files in rails? The Blue Ridge framework(as far as i could understand) lets you test only the javascript files. But I wanted to test my "js.erb" files w...

jQuery/Javascript: tidy html

hi all, i'm got a little html-wysiwyg editor in my cms and was wondering - is there a good script for tidying up html client-side? i'm mainly struggling with html that's pasted from winword. maybe some regex would help already. thanks in advance ...

Why do some pages stall? (Ad Related)

I notice on bad quality websites with ads a piece of the site will load then stall for seconds then load in the rest of the site. With AdBlock it loads very quicky. What is causing the stall? Is there a simply way around it? ...

Purpose of JSLint "disallow insecure in regex" option

I have a line of code that gets the following error when run through JSLint: Lint at line 604 character 48: Insecure '^'. numExp = parseInt(val[1].replace(/[^\-+\d]/g, ""), 10); This error seems to refer to the following description from JSLint's option page: "true if . and [^...] should not be allowed in RegExp literals. These form...

jQuery saving show/hide state after page refresh or form submit

Hi. I am dynamically adding dependants to a form with jQuery link like so: $('a.add').live('click',function() { // Show the next hidden table on clicking add child button $(this).closest('form').find('table.child:hidden:first').show(); $(this).closest('form').find('hr:hidden:first').show(); // Get the number of hidde...

Getting form data and sending it to a new tab in the browser

Hi am creating a small form where you can place postcodes to get directions, it then sends this data with the URL of Google maps with the postcode in it to show the directions. I was wondering is it possible to somehow get thenew URL i have into a new browser tab / window. The idea is that the user input the postcodes and then presses ...

Event Handling order

javascript jquery event handling if on event (for example 'click') binded one function for parent element and another handler function for child DOM element, which of them are called? If all of them will be call in which order? Thank you! ...

JavaScript Mac Firefox setInterval() Wierdness

I first encountered a problem with safari, where set interval would behave unpredicatbly when the function name was not enclosed within quotations (and optionally it seams with added parentheses): repeatInterval = setInterval("foo()", 50); Upon changing my code to read in this way, it seams it does not get executed at all in the Mac v...

ASP.NET C# Javascript div Centering

hello everyone. I'm new here at Stack Overflow and this is my first question. I'm a rookie in .NET programming, my only real life programming experience is COBOL so go easy on me :p The thing is: I want to, when the user clicks a button on my website, to make a div appear in the center of the browser above all other content on the we...

IE splice and join issues

I am using this code to alter the title of an image. Basically it should split the dashes (there will always be at least one) and take the first part as the title and the remaining dashes as the description. This works fine in FF but not in IE (tested in v8) it gives me 'Object doesn't support this property or method' on the descriptio...

'Activating' JavaScript for each page in large web sites

Hi there, I am working on a medium size web site that has plenty of custom JavaScript written for it. At present all the script is stored in seperate JS files for each area of functionality. These are then minified and combined into a single, large JS file during our build process. For each page, the relevant JavaScript is usually exe...

jQuery.val() method failing to set value on a select list?

The following code failed when I upgraded to 1.4.1, and worked ok when I rolled back to 1.3.2. var ddlCountry = $("#<%= this.ddlCountry.ClientID %>"); if (ddlCountry.val() == "") { ddlCountry.val(address.country); ddlCountry.change(); } BTW the problem is that the value of the <select> list is never set. Yes, this is all ...

How do I display values of an JSON object?

Here is what I got so far. Please read the comment in the code. It contains my questions. var customer; //global variable function getCustomerOption(ddId){ $.getJSON("http://localhost:8080/WebApps/DDListJASON?dd="+ddId, function(opts) { $('>option', dd).remove(); // Remove all the previous option of the drop down ...

jcarousel not appearing in Chrome, Safari, Opera

Hello here is the problematic page:http://sideradesign.com/eco-art/gallery/ The gallery displays in IE8 and Firefox, but not in Chrome, Opera or Safari. Let me explain : first of all, I'm not an expert in javascript, I have just copied a wordpress plugin code into the functions.php file and hacked away at it until it worked in Firefox. ...

For loop for object?

Hello, I have the next code in javascript. I deleted some unnecessary items because it went to long. var options = { dhcode: true, commands: { bold: { enabled: true, view: true, exec: true, cmd: 'bold', param: null }, italic: { enabl...

Bitshift in javascript

I've got a really big number: 5799218898. And want to shift it right to 13 bits. So, windows-calculator or python gives me: 5799218898 >> 13 | 100010100100001110011111100001 >> 13 70791 | 10001010010000111 As expected. But Javascript: 5799218898 >> 13 | 100010100100001110011111100001 >> 13 183624 | 10110011010...

Event Bubbling with Prototype

I have written a news scroller which uses the Prototype and Script.aculo.us libraries to scroll through the news feed at a set interval. There are buttons included in each news item that allow the user to manually scroll the news feed up or down manually. When the page is loaded the buttons are assigned event handlers for when they are c...