javascript

how to close the child window when closing parent window in javascript?

Hi friends, how to close the child window when closing parent window in javascript? Thanks in advance. ...

How to view the last GET HTTP request in JavaScript

How can I view the last GET http request in JavaScript? Basically what I am after is what I can see my firebug console. When XMLHttpRequests are showing in console I see a line that looks something like: GET http://www.domain.com/php/file.php?q0&c=1 200 OK 163ms How do I view that URL in JavaScript? EDIT: Just to be clear...

How select button in JQuery

<?php foreach ($list as $item): ?> <tr> <td> <div id="<?php echo $item['id']; ?>"> <input type="text" name="name" id="name"/> <button type="submit" id="ajax_submit" value="<?php echo $item['id']; ?>">run</button> </div> </td> </tr> <?php endforeach; ?> In this php-code I generate html table. When user click ...

Javascript FAB framework on Node.js

I've seen a slide that presented Fab, a node.js framework. Is this JavaScript? Could someone explain what is going on in that code? I'm all lost. ...

search and replace with jQuery

Hi, I want to search a keyword into body and replace it with a link if it is already not linked to somewhere. My code is : var search = $('body').html(); search = search.replace(/jQuery/g, function($1){ return('<a href="http://jquery.com"&gt;' + $1 + '</a>'); }); $('body').html(search); The problem is, it replaces all keyword ev...

Function constructor vs function statement

Hi, today I've read we have a way of declaring the function by Function constructor. But I never seen the actual implementation that uses Function constructor in real. So I would like to ask, are there any circumstances that we can get benefit by using Function constructor as opposed to using function() declaration? And what are the hidd...

Adding a list item client-side

I'll say right off the bat that I'm a complete beginner to Rails, so this might be something obvious that I'm missing. I have a web form for editing an unordered (<ul>) list of questions. Each question is an item in the list. Each question has a text field for the question text and a dropdown to indicate what type of question it is (mul...

I'm using a mobile broadband usb stick and it's inserting a script into my pages. How can I stop it?

I've recently started using a 3G mobile broadband usb stick. It's from T-Mobile, a UK mobile commmunications company. All seemed well, until I tried to test a site which I've been developing locally on by uploading it to my live server. When I look at the code of my live site, I can see that 2 things strange are happening: -1. A script...

How can I resize an image, added via ajax, to fit within specific dimensions while maintaining aspect ratio using JQuery/CSS?

I've got a web application that loads some content from an external source to the dom via an ajax call, one of the things that comes back is a set of images (different sizes and aspect ratios) to be displayed in an profile photo section. I'd like for each of the images to be resized to fit within a 64px x 64px area and I'd like to mainta...

Using Joomla's baseurl to import javascript

Hi, I am trying to use Joomla's basurl to link to my javascript files like this: <script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/js/music.js"></script> My code highlighting though seems out of whack and I am wondering if anyone knows how I should be writing this please? if I use it in the css link everythi...

Find word on page, wrap in span tags with class.

I would like to Find word on page, wrap in span tags with class. before proceeding to execute a javascript i have almost got ready. If i can work out how to just do this first part i think i can get the rest. Find word on page, wrap in span tags with a class applied to the span tags. Must then be searchable via:      $(document).ready...

Clicking inside canvas element selects text

I have a canvas element in my HTML document. When I click inside of the canvas multiple times, it selects part of my <h1> element's text, which is before the <canvas> tag. Is there a way to stop this from happening? I am guessing there is a JavaScript solution. ...

Weird onstorage triggering in Safari

Hello, everybody, i've encountered the following issue in the Safari 5.0 (not in all WebKit-based browsers), this code: <html> <script> var on...

JQuery UI slider show but doesn't respond to events after the first click.

I setup three sliders. One is a range, and the other two are regular. The sliders render on the page, but on first click they go to either min or max. After that they seem to be stuck. Adding console.log to the event handlers show that they don't respond to anymore events after the first click. There are no console errors either. I...

How to trigger a click event programmatically?

I'm trying to click panel splitter collaplse/expand button with javascript / jquery, to no avail. Here is an example of the splitters: http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx;jsessionid=GTYNMf7Mq2JD6L4v38yCdTh2HLplhJYLTGc1J1TjZFwmpZjcqh1n!-294683649?_afrLoop=28596129526428344&amp;_afrWindowMode=0&amp;_a...

How to change this code in order to work another way

I have this code : <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt; <script> $(function() { $(".button").click(function() { var dataString = "message= "+...

Replace <span> element with var containing html.

I have a variable i lifted the contents of, from a div on the page, like so: var originContents = $('#origin .teleportMe').html(); there is a set of span tags, with class="insertionPoint" on the page, i would like to remove and replace with the contents of the origin div. i would prefer to do this with jquery but not essential. repl...

Need help resolving a JavaScript conflict using jQuery Anything Slider

The site has an existing rotating header banner and I am attempting to add CSS-Trick's AnythingSlider to the body. When the AnythingSlider is added, the rotating banner breaks. Here is my test page http://www.visfire.com/slidertest.html. Please see the home page to view the current rotating banner in action. I have tried turning off ...

AutoSuggest from a array

Hi, I have a php script which generates JS array in this form new Array( new Array("Maine", 1), new Array("Maryland", 2), new Array("Massachusetts", 3), new Array("Michigan", 4), new Array("Minnesota", 5), new Array("Mississippi", 6), new Array("Missouri", 7), new Array("Montana", 8) ); ...

How can I listen for the drag/drop event in CKeditor?

I'm building an application that requires the user to drag and drop html elements onto a CKeditor instance. I need to listen for the drop event so I can take action to remove the element that was dropped onto the editor. I see that there's a 'paste' event, but it's not triggered by the drop. Here's my simple test, using the CKeditor jqu...