javascript

parse xml response with jQuery

HI all, I use jQuery to parse my xml responses. I have this xml : <?xml version="1.0" encoding="UTF-8"?> <response status="ok"> <client_id>185</client_id> </response> And i want to get "client_id" value. ...

IE7 Ext JS problem: Unspecified JS error on window.close()

I am using Ext JS to make a popup window, here is the code: function popupImage(term, imageNumber){ if(currentPopupWindow!=null){ currentPopupWindow.close(); } currentPopupWindow = new Ext.Window({ layout : 'fit', closeAction :'hide', plain : true, ...

Dynamically adding controls to the page with ASP.NET Ajax library

Is it possible, with the ASP.NET Ajax library (Sys....) to add controls to the page. For example in JQuery I would perform $("#mydiv").append($("#anotherdiv input")); Or something similar. I want to do this without wrapping everything in an UpdatePanel if possible, preferably through clientside scripting. But I have a feeling this wil...

Use JavaScript to place cursor at end of text in text input element

What is the best way (and I presume simplest way) to place the cursor at the end of the text in a input text element via JavaScript - after focus has been set to the element? ...

What does this javascript syntax mean?

I am trying to understand a script generated by Asp.Net Ajax Toolkit, which is currently giving an "object expected" (error goes away if I place my PopupControlExtender in an update panel). document.getElementById('ctl00_ValidationSummary1').dispose = function() { Array.remove(Page_ValidationSummaries, document.getElementById('ctl00...

Prototype plugin for dynamically expanding textarea

Does anyone know of a good plugin for prototype which allows textareas to automatically expand / contract based on how much text there is in them (e.g. a line is added the area gets bigger, a line is removed it gets smaller)? I need one thats free to use (e.g. some form of GPL type license). ...

Using doPostBack Function in asp.net

Hi, i want to use doPostBack function in my link.When user clicks it,it wont redirect to another page and page will be postback.I am using this code but it doesnt function.Where do i miss? < a id="Sample" href="javascript:__doPostBack('__PAGE','');"> function __doPostBack(eventTarget, eventArgument) { var theform = documen...

Using firebug, where are the js errors shown?

Hi, using firebug, where are the js errors shown when the page renders? (if you have any good js debugging links w/firebug send them my way please!) ...

How to get ID when you pass my ID

Hi, I have a function that gets passed the document object like: toggle( $('username') ); function Toggle(id) { /// ?? } How can I get the actual name of the object passed i.e. username? ...

Rotate images, if last image then hide

Hi, I have 3 images that I want to rotate when a button is clicked. image1, image2, image3. If the image is at image1, then when clicked it should show image2 (and so on, in order of image1, .., image3). When I am at image3, it should then hide the image, i.e. don't display it. I need some help with the javascript function to do thi...

How to supply a value to the javascript method Date.setTime() from PHP?

Is it time()? Is it time().substr(microtime(), 2, 2)? Is it time().substr(microtime(), 2, 3)? Kind of lost with the following snippet. function updateClock ( ) { var timeStamp = <?php echo time().substr(microtime(), 2, 2);?>; var currentTime = new Date ( ); currentTime.setTime( timeStamp ); ... ... } My goal is t...

js function to get filename from url

Hi, I have a url like http://www.example.com/blah/th.html I need a javascript function to give me the 'th' value from that. All my urls have the same format (2 letter filenames, with .html extension). I want it to be a safe function, so if someone passes in an empty url it doesn't break. I know how to check for length, but I should ...

javascript function which ensures a text contains only dollar symbols formatted as $placeholder$

I need a javascript function which gets a string and returns false if the string contains - Any unclosed dollar symbol - Or a closed dollar symbol with something between dollars different than a series of characters function validateFormat(text) { // Do stuff } For example if text: validateFormat("blab abalaba $something$ avava $aff...

To use the Gears WorkerPool in GWT do I have to write the same code in Java and Javascript?

In order to use the WorkerPool (Javascript Threads) class and functionality in GWT/Gears, do I need to write my code in both Java and Javascript? Upon inspection of WorkerPool - Getting Started and the sample WorkerPool application in the GWT-Gears-1.1 download package it seems that I need to. It seems that the Java code is used to dem...

Setting background-image using jQuery css property

Hi, I have a url in a variable, and I am having issues setting the value in css. $('myOjbect').css('background-image', imageUrl); Any pointers? ...

Add a link stylesheet dynamically in the <head>

Hello, How to add a link stylesheet reference to the head of a document ? I've found this code but it's not working with all browsers, it crashes my IE7 : var ss = document.createElement("link"); ss.type = "text/css"; ss.rel = "stylesheet"; ss.href = "style.css"; document.getElementsByTagName("head")[0].appendChild(ss); Thanks ...

Modifying a YUI RTE toolbar after it's been created

I am in a situation where I do not control the creation of one or many YUI Rich Text Editors; it is done in someone else's library. For the purposes of this discussion: patching code-- monkey or otherwise-- is not an option. removing (editor.destroy()) the editor that's already there and adding my own is also not an option. The code ...

Check browser tabs by JavaScript?

Can I check if host page for a JavaScript is active by the browser's tab in IE7/FF/Opera? Checking other tabs than the page where this JS runs would probably be a security risk though.. My other option is a method I remember by prototype to check if the mouse cursor is active, but it's not that accurate. ...

In jQuery, how can I tell if the current object is hidden or not?

Hi, Before I call: $('myObject').show(); I want to know if it is currently hidden or visible. ...

JQuery Modal Boxes and Iframe

I've been using Simple Modal and i feel it doesn't live up to what i need at the moment. Is there a Modal Box that supports loading external files and allows those external files to close the modal box and redirect the parent page to some url. An example of what i want to do. You have a list of users, you could click "Add user" and a M...