javascript

correct this xpath expression please

This is a piece of my XML document: <?xml version="1.0" encoding="UTF-8"?> <catalog> <mfVictor> <decal> <company>Victor</company> <title>Wood Horn with Blue Background</title> <image> <url>victor01.jpg</url> <width>60</width> <height>60</height> <name>Wood Horn Blue Background</name> <link></li...

In jQuery, using $.extend(), is this redundant?

Hey, I was wondering if setting an object equal to $.extend(), but setting the target to the same object is redundant? setOptions(options = $.extend({ classPrefix: 'imgareaselect', movable: true, resizable: true, parent: 'body', onInit: function () {}, onSelectStart: function () {}, ...

Cross-server javascript issue? js on one server, accessing another server

Hi guys, I had a question. I have a coldfusion server that has javascript, and I am using Flex on another server. I need to use javascript from the CF server to access the Flex server, and wanted to know if there would be any cross-server (same domain though) issues that would arise. Thanks guys ...

javascript eval json with base64 encoded field.

I am using sun.misc.BASE64Encoder to encode an encrypted value, which is then added to a JSON field and subsequently sent to the client. I use Javascript's eval() function on the client to create an object from the JSON code. When eval() runs, it gives the error: unterminated string literal There are other fields in the JSON cod...

Can an Enum be serialized completely?

Hey everyone, I've got a .NET application running on WCF. In that application, I have a variety of "Types" defined ("CourseType", "PresentationType", "HierarchyType", etc) as enums. These are automatically synced with the database, so I can write nice code like: public enum CourseType { Online = 1, Classroom = 2 } ... if(course...

Execute JavaScript within responseHTML

When using responseHTML with XHR, Firefox executes the javascripts within the loaded responseHTML, chromium does not. if i add a script that will parse and execute the scripts, it will work on chromium but they result being executed twice in Firefox. Any idea how to know if browser will execute loaded scripts or not other than through ag...

How can I change the accordian pane's cssclass onmouseover event

I have an accordion pane which has two classes one for selected header and other for non selected assigned to it. Both these classes have a background attribute which consists of an image. Both these images are different. Now I need to change the class of the accordion pane onmouseover and onmouseout events. These new classes will hav tw...

Load jQuery in a js, then execute a script that depends on it

I have a unique issue - I am designing a web application that creates widgets that a user can then embed in their own page (blog posts, mostly). I want them to just have to embed one line, so I just had that line be an include statement, to pull a Javascript off my server. The problem is, I am building the widget code using jQuery, an...

Regex to remove all functions from a js file [Textmate preferred]

I'm working on a large and extremely messy javascript file, and I would like to remove all functions from the file, ultimately creating a version which contains only data. the code looks something like this: var foo : bar = "hi"; function foobar (){ //blah blah } var fobar:bar; var barfo:bar; function imSoUgly(){ //Blah blah blah b...

jQuery Cycle Intercepting Clicks

I'm using jquery Cycle to create a featured content slider. In my pager I have an image from each post and a link to the permalink. I can't link to the page, but I hope this image will give an idea of what I am doing: My problem is that when I click the permalinks in the right nav, they do not open. The links are formed properly and ...

Javascript String issue

Hi, i am trying to concat a query value into a link wwww.test/video (query value) ".flv" altought i think i did something wrong. function doSomething() { var test = new StringBuilderEx(); var a = querySt("number"); test.append("<h1>test</h1> "); test.append("<a "); test.append("href=\"http:...

Remove empty tags using RegEx

I want to delete empty tags such as <label></label>, <font> </font> so that: <label></label><form></form> <p>This is <span style="color: red;">red</span> <i>italic</i> </p> will be cleaned as: <p>This is <span style="color: red;">red</span> <i>italic</i> </p> I have this RegEx in javascript, but it deletes the the empty tags but ...

Javascript, Regex - I need to grab entries with parameters, potentially across multiple lines

Based on my previous question, I've come up with a better way to approach my problem. Here's what I have in mind: I want to start extracting word/space characters up to the first occurrence of a pipe ('|') delimiter, or else a newline. Trim whitespace at either end. This extraction will be the start of a new "entry". For each pipe f...

Execute jQuery after other scripts?

Hi, I'm trying to use jQuery to change some styling on my page. The page is made dynamically by executing another JavaScript file. Right now I have $(window).load(function(){ $('p').css('font','green'); }); Which does nothing. $(document).ready(function() will change the static part of the page, but not the generated part. If ...

What are the common defenses against XSS?

In other words, what are the most-used techniques to sanitize input and/or output nowadays? What do people in industrial (or even just personal-use) websites use to combat the problem? ...

Can we have external NoScript file?

Can we have external NoScript file? If javascript is not avaialbe i want to hide + and - from According page. How to do this if i can't edit html <head> i only can add any external css and js file ...

Weird HTML/JS/CSS scrollbar functionality puzzle

So, I have a particularly unique goal I wish to achieve with CSS, HTML and jQuery. Basically, I have a page element that when I mouse over it, I want scrolling to be disabled. I am currently achieving this by setting the body's overflow property to "hidden." However, the disappearing scrollbars means that content is shifting to the right...

Using Web Technologies for Flash

Hello, I'm an Avid Javascript developer, and am wondering if there's any to use Open web technologies (JS/HTML/CSS) to build a flash game. After a few Google searches, i've got nothing, so I'm asking here. ...

What is the best method to dynamically sandbox inline JavaScript?

I have a WordPress plugin that loads pages with AJAX and to ensure compatibility with other plugins and "widgets." As of right now I use the following code to evaluate all inline JS that is inside the content blocks to be updated: function do_JS(e){ var Reg = '(?:<script.*?>)((\n|.)*?)(?:</script>)'; var match = ne...

Dynamic javascript injection without createElement

When running code in the context of a "thread" in the Google Gears API you do not have access to the "document" object and therefore createElement cannot be used to dynamically load a script. Does anyone have any ideas about how I might go about "injecting" code in such a scenario? The only method I can think of is using a webservice an...