javascript

How to pass data from Ajax popup to parent page?

I currently have an Ajax pop up window displayed from the main page of my application. In this pop up I have select list and I want to pass the selected value from the pop up back to the main page when the user closes the pop up window. I feel there is an elementary way to do this, but I can't seem to figure it out. ...

Database blob holds multline html code, how can I convert this into one line with php

Ok, so basically I am using the fckeditor as a way for my user to enter some information. When it is stored in the DB it is stored like so, <p> </p> <div style=\"margin: 0in 0in 10pt\"><b><span style=\"color: #666666\">Test Title</span></b><span style=\"color: #666666\"> <br /> Address goes here <br /> This is some lengthy text about ...

JSON: How do I alert the name of the first node in level 1 in this code snippet?

var response = "{\"tree\":[{\"level1\":[{\"node\":{\"id\": 1,\"name\": \"paradox\",\"parent\": 0}}]},{\"level2\":[{\"node\":{\"id\": 2,\"name\": \"lucent\",\"parent\": 1}},{\"node\":{\"id\": 3,\"name\": \"reiso\",\"parent\": 1}}]},{\"level3\":[{\"node\":{\"id\": 4,\"name\": \"pessi\",\"parent\": 3}},{\"node\":{\"id\": 5,\"name\": \"misho...

Help with Mootools code

So I am using the mousenter demo from mootools. I put it on my site trying to affect the links so when someone hovers over them the link fades into another color. The problem I am having is that the mootools code is only set up to handle one ID! Since I am using it for a nav, I have multiple IDs that I want to change. How can I affect a...

How can I get Javascript to work within Prototype AJAX Request

I'm trying to pull in HTML/Javascript from an external PHP page using Prototype/AJAX, and the HTML renders fine, but the Javascript doesn't work after the AJAX request. I'm also showing a loading bar while the page loads the data, and this part works fine. My Symfony PHP + Prototype code is below. Any advice that might put me in the rig...

How can I inject Javascript (including Prototype.js) in other sites without cluttering the global namespace?

I'm currently on a project that is a big site that uses the Prototype library, and there is already a humongous amount of Javascript code. We're now working on a piece of code that will get "injected" into other people's sites (picture people adding a <script> tag in their sites) which will then run our code and add a bunch of DOM elem...

Need Regular Expression for Javascript string replace

I need a regular expression that will properly work, the current one I have is breaking. The goal is Normal src for an image is: Image.png Using jQuery on hover I dynamically find the src of an image and replace it with ImageName-Dn.png On hover off it sets it back to ImageName.png My current solution: $(document).ready(function()...

Method delegation in Javascript/jQuery?

I have this code: var myWidget = $('#myWidget'); and calls like this elsewhere: myWidget.hide(); myWidget.slideToggle(); These work of course because jQuery adds these methods. Now, let's say I'm doing some refactoring to make myWidget a proper object with its own custom methods and state: var myWidget = (function() { // priv...

What does this javascript do

window.$ = jQuery = $telerik.$; To the best of my understanding, there is an Object called $telerik. It has a function $. The function is assigned to the identifiers jQuery and window.$, so we can just use $(args) in our javascripts. Is it correct? It should mean that we can also use jQuery(args) to find an element. ...

Javascript : Enter Key Press

Hi All, Good Morning... I am using java script in each page to trigger the Enter key press Event inside the textbox. It is working fine. Now i want to place the code in the .js file for global access. function EnterKeyPress(id,e) { // look for window.event in case event isn't passed in if (window.event) { e = window.ev...

jQuery - parsing JSON data - Having trouble with variable name

My first delve into working with JSON data. I have a bit of experience using jQuery though. I'm posting to this URL (tumblr api): jyoseph.com/api/read/json What I'm trying to do is output the json that gets returned. What I have so far: $(document).ready(function(){ $.getJSON("http://jyoseph.com/api/read/json?callback=?", functio...

Storing cookies via XUL using document.cookie

Hello Everyone, I created a FireFox extension. This extension has some configuration settings and I'd like to store them in a cookie. To store information in a cookie I used the regular JavaScript property document.cookie Initially everything seemed to work fine, but then I noticed that the cookie is just a session cookie. Whenever I r...

Accessibility and code organization problems in javascript with jquery.

I'm having troubles with the order of my code in my program. right now I have some things with in document.ready(function() { } ); and some things out side of it. Whenever I move anything (to organize or improve my code) I end up breaking something, I'm guessing because of either order of declarations or access levels (ie. something outs...

innerHTML removes attribute quotes in Internet Explorer

When you get the innerHTML of a DOM node in IE, if there are no spaces in an attribute value, IE will remove the quotes around it, as demonstrated below: <html> <head> <title></title> </head> <body> <div id="div1"><div id="div2"></div></div> <script type="text/javascript"> alert(document....

Close window without user confirmation in classic asp

I need to close a window without user confimation box or a message box prompting "the webpage you are viewing is trying to close the window. Do you want to close this window? (yes/no)". Please help.. ...

How to get javascript in one frame to wait until a page has loaded in a second frame

I have two frames in a frameset - frame[0] contains a script that loads a page into frame[1] using top.frames[1].location.href = 'http://some_location.com/page.html'; and then performs actions on that page, for example searching text within the page. I need the script to wait until page.html has loaded in the second frame before doing...

how to empty an array in JavaScript

Hi, if there is an array, is it possible to empty with .remove() for instance if A = [1,2,3,4]; how can I empty that. thanks ...

canvas tag drawing lines problem.... ....

I have a canvas tag, I use it draw lines on that, the canvas is a square. I use "space" to record the space between two lines. and I have canvasWidth and canvasHight to record the canvas size, actually, they are the same numnber....320 var x=0; for (var i = 0; i < 5; i++) { x = parseInt(x + space); ...

gwt+comet need configure tomcat?

hi, i am refering to this tutorial http://www.jroller.com/masini/entry/a_comet_implementation_for_google . is it a must to configure tomcat when using comet? can gwt+comet run on hosted mode or required -noserver? ...

two clashing javascripts

hi, I'm a n00b when it comes to javascript. I have two scripts which I found online that I am trying to use on the same page. One is prettyPhoto(http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/) which I am using for the light box effect. The other is slideshow (http://slideshowjs.com/) which I'm using in th...