javascript

self-reference within declaration of a structured javascript variable

Suppose I declare a structured Javascript variable like this: var mydata = {'list':[ {'fname':'george','lname':'washington'} ,{'fname':'oscar','lname':'wilde'} ,{'fname':'james','lname':'polk'} ] ,'summary':this.list[1]['lname'] } Question: How can I ensure that this.list[1]['lname'] equals 'wilde' and that my "this" is actually re...

Update dynamic html attribute

What im trying to do is when the p inherits the class "active" that div.test will print the link rel correctly. Currently if the page loads without the class assigned to the p tag, it will not. How can I make it happen when the p tag inherits the class "active" the link printed in div.test will get the rel printed correctly? $(documen...

Moving focus when opening a panel using JQuery

on the following site i have two hidden panels labelled "show map" and "show floor plans". When the the header of each is clicked the slide panel is opened. The floor plans is long and thus will go below the page view. is there anyway to keep focus at the bottom of the panel, so that when it's clicked you manage to see the whole windo...

Search type links in Yahoo - how to implement similar behaviour

When you open the yahoo main page at the top there is a search section that contains links like: Web, Images, Video, More When clicking on the link the chosen section is activated and the text of the search button is being changed. The only part of the page that is updated is the search part at the top and the other parts of the website...

Slow page unload in IE

I am developing a site which creates many table rows dynamically. The total amount of rows right now is 187. Everything works fine when creating the rows, but in IE when I leave the page, there is a large amount of lag. I do not know if this is some how related to the heavy DOM manipulation I am doing in the page? I do not create any fun...

javascript conflicts UpdatePanel

I'm using a ReportViewer control which often runs into problems with the javascript associated with UpdatePanels in ASP.NET. I've created a second page which is very simple, no Update Panels. What's the best way to link the two pages? An iframe sounds bad. However, having to run a report, then be returned a link to the results also s...

Javascript - How to detect if document has loaded (IE 7/Firefox 3)

I want to call a function after a document loads, but the document may or may not have finished loading yet. If it did load, then I can just call the function. If it did NOT load, then I can attach an event listener. I can't add an eventlistener after onload has already fired since it won't get called. So how can I check if the documen...

is there an easy way to convert jquery code to javascript?

hopefully the question doesn't sound stupid, but there are lots of examples out there of achieving certain things in javascript/dom using jQuery. Using jQuery is not always an option (or even a want) which can make understanding the examples of javascript solutions written in jQuery hard. Is there an easy way to convert jQuery code to r...

Which method to use in Coding a Javascript "Plugin"

I am creating an in-page editor using FCKEditor. Essentially there will be multiple div's on a page, with each div being editable having certain tags as identifiers. When you click on a div, it will convert into an FCKEditor, and place the toolbar above. All the other text areas are disabled. I have this working, however I am looking a...

Dynamic height for popups depending on content, is it possible?

Is it possible to get a window popup with always 400px wide, but dynamic height depending on the content in the popup window? I have seen this but not sure how to apply it to popup windows http://stackoverflow.com/questions/819416/adjust-width-height-of-iframe-to-fit-with-content-in-it ...

rounded css in cluetip

I'm using cluetip for my page, it's work fine in IE 6 and IE 7 but in firefox the rounded box can not wrapped all the content include an image and some text. I couldn't fix this all night long. Some one had an experience show me the way please! Thank you very much! My code look like this: <li> <a href="#" class="scroll" rel="div#1"> <im...

Is there a built in method to merge the properties of two objects into a single object?

I'm looking for a built-in method that combines two associative arrays or objects into one. Using webkit in Adobe Air if that makes a difference. But basically I have two objects or associative arrays if you will: var obj1 = { prop1: "something", prop2 "anotherthing" }; var obj2 = { prop3: "somethingelse" }; and I want to do merge the...

Finding malformed XHTML with Javascript

Does anyone have a good way of finding if a string contains malformed XHTML using Javascript? Since my page allows 'user' generated XHTML returns (the users can be trusted) and injects it into the DOM, I want a way to check if there are unclosed or overly closed tags, and encode them as &lt; and &gt; so that it will simply display the e...

How to sort a JSON array ?

I read in the following JSON object using ajax and store the object as an array: var homes = [ {"h_id":"3", "city":"Dallas", "state":"TX", "zip":"75201", "price":"162500"}, {"h_id":"4", "city":"Bevery Hills", "state":"CA", "zip":"90210", "price":"319250"}, {"h_id":"5", "city":"...

How do I focus an HTML text field on an iPhone (causing the keyboard to come up)?

I'm writing an iPhone web app, and I want to automatically focus a text field when the page is loaded, bringing up the keyboard. The usual Javascript: input.focus(); doesn't seem to be working. Any ideas? ...

How can I pass arguments to event handlers in jQuery?

With jQuery code like: $("#myid").click(myfunction); function myfunction(arg1, arg2) {/* something */} How do I pass arguments to myfunction while using jQuery??? ...

Countdown timer using jquery or google app engine ?

hi everybody, I need to do a countdown clock, that counts down the days, hours, minutes and seconds that are left to a date of my choice,Using jquery or google app engine(Python). I created a timer using Javascript,But in that i used system time. I need to use server time.Can any body give me ideas to build up a count down Timer using...

JavaScript: toggle links active/deactive

How do I toggle HTML links from being active / deactive using JavaScript? Within my HTML, I have 2 hyper links that call a JavaScript function to sort a table: <a href="javascript:sort('asc');">ASC</a> | <a href="javascript:sort('desc');">DESC</a> What I would like to do is when someone clicks the "ASC" link, it then deactives the "A...

jQuery or javascript: Get dynamic div height in IE

This works in Firefox/Safari but not on IE var h = parseInt($('#elementWhichHeightCanChange').css('height')); alert(h); on IE it returns NaN. Anyone know how to get div height depending on its content on IE? I want to resize this popup window to fit the content, which currently works only on Firefox. Thank you in advance. ...

Microsoft.Windows.ActCtx on Windows Xp

These days I'm very much busy on developing an activex/com application. Some of our customers are working under heavily restricted windows environments. So i decided to make my application regfree. I found genman32.exe which can easily create manifests (also mt.exe is useful). Everything went fine but when i tried to execute my applicati...