javascript

Change the tag but keep the attributes and content -- jQuery/Javascript

Hello! How can you get: <a href="page.html" class="class1 class2" id="thisid">Text</a> changed to <p href="page.html" class="class1 class2" id="thisid">Text</p> I'm familiar with jQuery's replaceWith but that doesn't keep attributes/content as far as I know. Note: Why would p have a href? Cuz I need to change p back to a on a...

How can I prevent XMLHttpRequest to cache requests without jQuery?

I have an webapplication which refreshs a table each minute from a xml-file. When I edit the content of the xml-file, the log of the script shows a "304 Not Modified"-Message when it try to get the current file. But the file is edited. If i refresh the xml-file http:/xx.de/test.xml in the browser, the webapplication also shows the edit. ...

find out if css of layer is block jquery

I'm trying to figure a way of finding out if a layer is displayed or not if ($('.property > .evenprop').css('display','block')){ $('.otherprop').show(); } else { $('.otherprop').hide(); } So something like if this is true <div class="property"> <div class="evenprop" style="display:block">blah</div> </div> The...

Using two or more images on a page with prototype object of javascript

Hi I am using this script. http://digitalhymn.com/argilla/tipmage/ It is not possible to apply Tipmage to more than one image in a single page Is this possible to apply this class to more than one image? Thanks ...

change in OS (ubuntu 10) time does not get reflected when using the JS Date object

I have a small script that uses inbuilt JS Date Object to fetch current system time In case I change the OS time(Ubuntu 10.04) , The new time is not automatically getting reflected in the script , It keeps on displaying old time. On refreshing the page new time gets displayed. Is it an expected behavior or a workaround that automatical...

AJAX XML tree without server-side language.

I need to make a nodes tree from data.xml file (as here link text) with AJAX. Is it possible to do this without the server programming language? I can get the whole data.xml file (all nodes) - but I need to load nodes dynamically (depending on the current tree view). ...

Reloading page through javascript: avoid the "Postback" warning

I'm triggering a page reload through javascript, using the following: window.location.reload(true); However, in some cases (of previous postback), the browser is giving me the following warning "To Display the webpage again, the web browser needs to resend the information you've previously submitted...". Is there any way of avoing th...

find out if a id has certain text and then change it

I need to something like this if($('#ctl00_lblNoResults').text('Please select')){ $('.otherprop').text('Thanks') } else { $('.otherprop').text('No Thanks') } So i have a layer like so <div id="ctl00_lblNoResults">Don't select</div> And another bit of text <div class="otherprop">No Thanks</div> I need to change the text of "other...

creating a associative array/hash in javascript

Hi I have a form with different groups of checks boxes and trying to pass all the selected values into an array then pass that data into a ajax request. $('#accessoriesOptions input').each(function(index, value){ if($(this).attr('checked') ){ var newItem =[]; var obj = {}; obj[$(this).attr('value')] = $(this)...

Javascript Code Performance analysis tool

Hi, I am stuck with one task now. Requesting your help on this. Description : There is a functionality written in purely javascript - but with lack of performance. Its taking more than 3.5 seconds to complete the workflow. Of cource, Its includes a lot of DB calls & functionalities and loops. This set of codes written by long years a...

Ajax callback refresh div

Hello All, I implemented a Ajax callback function to update a div (announcement) in my web page. It works fine, but the current issue is that the Ajax call function update the announcement div, however, after rewrite the content, the Javascript functions in this content are not load it. Therefore, my toggle function in table does not...

Parsing Custom JavaScript Annotations

Implementing a large JavaScript application with a lot of scripts, its become necessary to put together a build script. JavaScript labels being ubiquitous, I've decided to use them as annotations for a custom script collator. So far, I'm just employing the use statement, like this: use: com.example.Class; However, I want to support an...

How to go from C/C++ & Python Game programming into Web Programming?

I have been programming in C/C++ for about five years and Python for three; I mainly program in Python though. My main focus has been on Game programming and Network programming (centered on making scalable multi-player servers.) Recently I have been wanting to switch over to web programming; predominately client-side based applications ...

How to deal with different kinds of encoding in the javascript

I recognized that based on a context in which I want to use some parameters, there are at least 4 kinds of encoding that are necessary to avoid corrupted code being executed : Javascript encoding when constructing a javascript code, e.g. var a = "what's up ?" var b = "alert('" + a + "');" eval(b); // or anything else that executes b ...

How do i alter the content of an iframe in the dom using firefox extension code?

I would like to alter the page shown in my browser using a firefox extension (add-on) i wrote. I am able to get the page's iframes as XPCNativeWrapper object using: iframes = window.content.document.getElementsByTagName('iframe') for (var i = 0; i < iframes.length; i++) { var elmInput = iframes[i]; Firebug.Console.log(elmInput); } ...

copy paste table to chrome, textarea.value no new lines

try this in chrome (ff,ie works ok): in msword or writer make a 3 row table. In each row put something, select all rows and copy paste to chrome textarea. Each row is now in new line but when you check textarea.value there is no new lines ..strange even spliting by \n or \r not working textarea.value always return one line output any id...

Custom validation through Web-method

For validating login field (at register form) I use customValidator <asp:CustomValidator id="uniqueLoginValidator" class="validator" runat="server" ControlToValidate="tbUserName" ErrorMessage="Login duplicate" ClientValidationFunction="LoginValidate"/> For validate login I need consume wcf, so decide use web-methods <scrip...

href="javascript:" vs. href="javascript:void(0)"

Our web app is rendered totally on the browser.The server only talks to the browser through JSON messaging. As a result, we only need a single page for the app and mostly all the <a> tags do not have a real href pointing to other pages. In my quest of removing unnecessary things I was wondering if I can get rid of the zillions of void(...

iPhone / iPad / iPod swipe events javascript

Im looking for (if possible) javascript libraries/plugins to provide swipe events. However I am not after the simple detection of a swipe, for example what jqTouch provides. I wish to create behavior similar to that of the images viewer on the iPod devices. So for example you drag left or right to go to the next image. You have to drag ...

problem with firefox to parse the xml file using google map api

Possible Duplicate: how to parse xml file using google map api I have the following code which returns xml output sucessfully but their is problem with parsing xml and displaying output on the map.when i look the request and response output on firebug i am sucessfully getting xml file but problem with parsing that particular f...