javascript

Generate canonical / real URL based on base.href or location

Is there a method/function to get the canonical / transformed URL, respecting any base.href setting of the page? I can get the base URL via (in jQuery) using $("base").attr("href") and I could use string methods to parse the URL meant to being made relative to this, but $("base").attr("href") has no host, path etc attributes (like win...

JQuery fadeIn after src changed but fadeIn on the previous src anyway !

Hello ! I have a jquery bug and I've been looking for hours now, I can't figure out what's wrong... I have this code : $(document).ready(function(){ $('#ulPhotos a').click(function() { var newSrc= $(this).find('img').attr('src').split("/"); bigPictureName = 'big'+newSrc[2]; $('#pho').hide(); $('#imageBig').attr("...

Using jQuery to gather all text nodes from a wrapped set, separated by spaces

I'm looking for a way to gather all of the text in a jQuery wrapped set, but I need to create spaces between sibling nodes that have no text nodes between them. For example, consider this HTML: <div> <ul> <li>List item #1.</li><li>List item #2.</li><li>List item #3.</li> </ul> </div> If I simply use jQuery's text() method to ...

While doesn't work

function Sort(td) { var t=document.getElementById("theList"); var rows=t.getElementsByTagName("td"); var cells=t.cells; var bb=true; while(bb==true) { alert(bb); for(var i=1;i<rows.length;i++) { if(cells[td.cellIndex+i*4].innerText<cells[td.cellIndex+(i+1)*4].innerText) { ...

javascript class calling XMLHttpRequest internally, then handling onreadystatechange

this thing almost works: function myClass(url) { this.source = url; this.rq = null; this.someOtherProperty = "hello"; // open connection to the ajax server this.start = function() { if (window.XMLHttpRequest) { this.rq = new XMLHttpRequest(); if (this.rq.overrideMimeType) this.rq.overrideMimeType("text/xml"...

asp.net path problem when deploying

We have moved a lot of images and javascript file that was inside class to external Javascript file. In development (Debug inside Visual Studio), everything look nice, all images show, all javascript works and all CSS display perfectly. When we do a package and install with IIS ina virtual directory everything that is pointed by the Java...

Is it possible to create a nav slideshow using Canvas divs?

I'm trying to implement the sliding nav as described in this simple tutorial: http://sixrevisions.com/tutorials/javascript_tutorial/create-a-slick-and-accessible-slideshow-using-jquery/ But rather than using images, I'd like to use charts from this charting package: http://www.highcharts.com/documentation/how-to-use I've found that wh...

jQuery Galleria plug-in: Make auto-play?

I am using this jQuery plugin It is very nice, but I can't seem to figure out how to get it to auto-play. (automatically transition to the next image at an interval) Has anyone else gotten this to do that? ...

tail -f in a webbrowser

I've created a Python script that monitors a logfile for changes (like tail -f) and displays it on a console. I would like to access the output of the Python script in a webbrowser. What would I need to create this? I was thinking about using Django and jQuery. Any tips or examples are greatly appreciated. ...

jquery - dom manipulation

I would like to show in dialog all elements with specific class. The dialog should hide the rest of the page. So for example: On this SO page I want to show all elements with class="user-info". Those elements would be shown in dialog with same width and height and same css and everything else would be hidden. It would be like cutting th...

How do I "find" in Jquery?

$("#start").find(divs where class=desc).show() <div id="start"> <div class="desc" style="display:none;"></div> </div> How do I do that? ...

Preventing a Firefox Extension's load event from triggering across tabs

Hi, I've been working on a Firefox extension that uses an iFrame to do some background scrapping. I have gone through a number of hoops to get it to trigger only once in the window/tab where it should but now when I open a different tab that tab triggers the load event. I found this: https://developer.mozilla.org/en/Code_snippets/Progr...

How can i display function return value on alertbox in asp.net

when we want to display the output of the javascript function on Alert Box. i am unable to doing so pls help me. ...

How to get selenium to click on an object other than by ID

So here is a little challenge. I have an image. It has 2 attributes: a random ID - not helpful an image url - but it is a button, and other buttons use the same image url, not helpful a CSS class - also used by too many other things to be helpful a style - neither helpful nor unique This image is however inside of an anchor tag, but ...

How do I close an infowindow with Google Maps 3 API?

I've seen the other posts, but they dont have the markers being looped through dynamically like mine. How do I create an event that will close the infowindow when another marker is clicked on using the following code? $(function(){ var latlng = new google.maps.LatLng(45.522015,-122.683811); var settings = { zoom: 10, ...

Why are variables set on a page load not available in the document.ready scope?

I have an included javascript file thats initializes an empty array object called "widgets" var Widgets = {}; function Widget(a,b,c){ this.a = a; ... } in the same include a bunch of function prototypes are defined to add widget info to a widget: Widget.prototype.addWidgetInfo(a,b,c){ this.info.a = a; this.info.b = b; ... } the...

Numerical /currency pre-formatted in a form displays and stores incorrect values

I have a form field that uses some Javascript to format user input 'price' field from say 1000 to 1,000.00 in real time before the form is submitted ..when I submit the form some PHP is reading the data and printing the results Javascript bit is num = num.substring(0,num.length-(4*i+3))+','+ PHP bit is 'price' => number_forma...

How to determine if "html" or "body" scrolls the window.

The code below is used to find the element that can be scrolled (body or html) via javascript. var scrollElement = (function (tags) { var el, $el, init; // iterate through the tags... while (el = tags.pop()) { $el = $(el); // if the scrollTop value is already > 0 then this element will...

Is it possible to use 2 versions of jQuery on the same page?

NOTE: I know similar questions have already been asked here and here, but I'm looking for additional clarification as to how to make this work or good reasons for avoiding it entirely. I'm adding functionality to an existing web site that is already using an older version of the jQuery library (1.1.3.1). I've been writing my added func...

How to determine iFrame finished loading in UIWebView

Hey In my app, I need a way to tell when my webview is finished loading. It is very easy to do that if content is html. However, my content source is javascript with iFrame inside, it will cause UIWebView finishedLoad method called several times. Is there anyway I can check to see if the iframe is finished loading? ...