javascript

Cross window js interaction between a popup and another window of the same domain

i'm opening a popup from window a of http://example.com. then close window a and open another window b with same domain, http://example.com. ıs it possible to access popup's DOM from window b and how? popup is opened from window a by window.open('http://example.com/blah', 'somename', settings..), executing the same from window b with di...

QUnit output: visual separation of modules

My tests may look like this: module("some module"); test("test A", ...); test("test B", ...); module("other module"); test("test C", ...); test("test D", ...); The output of QUnit will look like this 1. test A (0, 0, 0) 2. test B (0, 0, 0) 3. test C (0, 0, 0) 4. test D (0, 0, 0) Is it possible to make QUnit output the module nam...

jquery preloading multiple images

Hi, I managed to do preloding of 1 image like this: var img = new Image(); $(img).load(function () { //do something after }).attr('src', response.image1); How can I make the same for multiple pictures. Let's assume that my response is a json object which has several image sources. Thanks! ...

Javascript: dynamically add onkeypress event in ie

I am trying to add an onkeypress event to a dynamically created p element. This works fine in Firefox, Opera, and Chrome, but not in IE. My code: function newParagraphAfter(elem) { blockElemId++; newPara = document.createElement("p"); newPara.id = 'block_' + blockElemId; newPara.innerHTML = "Edit Here!"; elem.parentNode.insertBefo...

JQuery and JSON

Hi, Here's something I want to learn and do. I have a JSON file that contains my product and details (size, color, description). In the website I can't use PHP and MySQL, I can only use Javascript and HTML. Now what I want to happen is using JQuery I can read and write a JSON file (JSON file will serve as my database). I am not sure if ...

How to get the "this" (scope) of a Javascript anonymous function?

Let's say I get an anonymous function an need to act on its context, but it's different whether it's binded to "window" or an unknown object. How do I get a reference to the object an anonymous function is called from? EDIT, some code : var ObjectFromOtherLibIAmNotSupposedToknowAbout = { foo : function() { // do something ...

Is this possible to embedded an image in HTML form?

Is that HTML form only support pure text only? Can I use some JS / CSS trick to let the HTML form have image embedded? ...

Need Help With Getting Cross Domain XML With JavaScript

Alright, so I'm building a web app that provides music information (i.e. info on artists, albums, songs, etc.) and for the info source I'm using the MusicBrainz API. Now, I'm trying to load the data from an API call and process it, with jQuery. This is the code I'm using: Code: queryString="http://musicbrainz.org/ws/1/artist/?type=xm...

How to get "raw" href contents in JavaScript

I am trying to write a GreaseMonkey script in which I want to find all of the links that are relative links. It seemed to me that the way to do that would be to match the contents of href against /^https?:///. But I find that when I access the anchor's href attribute, it's always normalized or cooked into a form that contains "http". ...

checking values in javascript

how can i check a value in javascript. for example: document.formname.subcategory.options[0]=new Option("Select Sub-Category",""); document.formname.subcategory.options[1]=new Option("Colleges","Colleges"); document.formname.subcategory.options[2]=new Option("Institutes","Institutes"); document.formname.subcategory.options[3]=new Optio...

how to show a textbox when a particular option from a dynamic dropdown is selected in javascript

i have this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="javascript" type="text/javascript"> function dropdown...

How can I make a menu similar to NFL.com's using jQuery?

How can I make a dropdown menu similar to NFL.com's using jQuery? I really like the way it stays hidden, while still providing all the convince of a regular menu. ...

JavaScript based cryptographic signing?

I am dealing with a particularly paranoid group of users who might want their contributions to my web site to be signed (e.g. with a GPG key) before submitting. While I could show them a "snippet" to copy and paste into their GPG tool, having the browser do this would certainly be nicer. With the JS performance of recent browsers, I'm ...

javascript limit display link from text area

i have a following feed from twitter and im making all links clickable and then i want that links which are inside a tag to be short to 30 chars, if its more then 30 chars then show ... after 30 chars twitter feed i need to start learning some real javascript from http://javascript.com/java/codes/snippet/search?q=javascript+limit+ch...

Listen for change events in forms: JQuery

Hello all, I have a form with an id of "wizard" - I only have select elements in this form. This form is in a lightbox using the JQuery plugin fancybox: I want to know when any of these have been changed using JQuery. How can I do this? I currently have: $('form#wizard select[name=servers], form#wizard select[name=cores]').change(func...

javascript dialog over a flash movie

Hello I have a such system: When the mainsite opens, A flash image gallery appears, when the user clicks on an image, using the Flash's "ExternalInterface.call" function, I call a javascript function that opens a java dialog modal named nyromodal (which fetches raw HTML data via ajax from another page inside the dialog box) on the flash ...

create style class in javascript

i want to crate style class in java script tags and class will be like this #file-ok { background-image: url(+ json.get('filename') +); } actually json.get('filename') will be name of file for background and will return from php file. is this possible...? ...

Sort lines on webpage using javascript/ regex

I'd like to write a Greasemonkey script that requires finding lines ending with a string ("copies.") & sorting those lines based on the number preceding that string. The page I'm looking to modify does not use tables unfortunately, just the br/ tag, so I assume that this will involve Regex: http://www.publishersweekly.com/article/CA659...

how to enable default after event.preventDefault()?

jquery toggle calls preventDefault() by default, so the defaults don't work. you can't click a checkbox, you cant click a link etc etc is it possible to restore the default handler? ...

why does this not work in IE - form submit problem

I have this working in all browser except IE. Why does it not work? Here is the site The form code is here: <FORM name ="frontpagequestion"> <input class="" type="text" name="questiontitle" value="ask your question and press enter" onfocus="if(this.value == 'ask your question and press enter') {this.value = '';}" onblur="if (this.valu...