javascript

Show javascript execution progress

I have some javascript functions that take about 1 to 3 seconds. (some loops or mooML templating code.) During this time, the browser is just frozen. I tried showing a "loading" animation (gif image) before starting the operation and hiding it afterwords. but it just doesnt work. The browser freezes before it could render the image and ...

Facebook Like-button problem

Hi there, I'm using this code to implement the like button <fb:like layout="button_count" show_faces="false" width="450"></fb:like> But when I try to click it the counter is increased for about 1 second and then it goes back to zero again. I can't see on my facebook profile that i've liked something either. Someone have a solution fo...

There is a JavaScript error in my rails application!

As the title said, I got a problem! i encountered the "RJS Error:[object error]",the code in my application is page << "#{hidden_print("#{url_for(:controller => 'tables', :action => 'dispatch', :id => id, :pop => true, :print =>true)}")} " the method hidden_print is def hidden_print(url) "window.parent.headFrame.document.all.i...

How to get correct table format ? Jquery ques..

This code prints output as given below... code: $('#calendar').append('<table><thead><tr>'); var i; for(i=0;i<=6;i++) { $('#calendar').append('<td>'+week[i]+'</td>'); } $('#calendar').append('</tr></thead>'); $('#calendar').append('</table>'); output: <section id="calendar"><table><thead><...

this.optional() in jQuery validation method doesn't seem to work

Hello, I've got a little problem here. I've got the following rule for one of my fields: StartDate: { required: isDelayed, dateRU: true } isDelayed() returns false, so I guess StartDate field should be optional. However if I check it inside my dateRU method: $.validator.addMethod( "dateRU", function(value, element) { ...

javascript - passing additional parameters into an event handler

Hi, I have a javascript object which has some defined variables and attaches some event handlers. I'd like the event handlers to have access to the defined variables. Is there a way to do that ? The event-handlers are within their own local scope so don't have access to the object variables. Is there a way to pass them in without using ...

Does remove a DOM object (in Javascript) will cause Memory leak if it has event attached?

So, if in the javascript, I create a DOM object in the HTML page, and attach event listener to the DOM object, upon I remove the the DOM from HTML page, does the event listener still exist and causing memory leak? function myTest() { var obj = document.createElement('div'); obj.addEventListener('click', function() {alert('wh...

Updating a popup window from source page

I have a list of people wrapped in a-tags with onclick for opening a popup window. That popup window contains a previous and next button that invoker a function in the parent window to get the previous/next a-tag and execute the onclick for it. nextAnchor.onclick(); This should update the popup window with the new persons info, bu...

looking for tool to convert unescape string to escapted string

Hello i just wander where can i find a tool that takes in my case java script string that is unescape and converting it to escaped string so i could use it as string value in c++ for example characters like " i need to convert it to \" i need something smart and not just replace all function . ...

Prevent blank links (having javascript:;) from openening in new tab/window on middle click...?

There is a common practice of using <a></a> tags to markup beautiful buttons, with onlick and onhover style change, etc. Which looks and behaves great, on most part. Although there turned out to be a HUGE problem, which was not very obvious on start. The problem is that these beautiful "buttons" open new windows on middle click, either ...

How to skip Google Analytics loading?

Turkish government have blocked some IPs including Google Analytics. This caused all the web sites using alanytics to slow down and even not to load. How can we prevent this problem? How can we skip loading of ga.js if not available? ...

Using JavaScript to render HTML; nothing appearing but values will alert

Hi, I'm taking some information from some variables I have already defined outside this function to create a html svg text box. Here is the function which is causing me trouble: RenderTextBox:function() { alert('this.x: ' + this.x); alert('this.y: ' + this.y); this.textBox = paper.text(this.x, this.y, this.htmlTextBox); } Th...

JavaScript Client Library

Can I download a user's profile photo and upload it using JavaScript Client Library?? ...

Get value from uncomputed css style with javascript / jquery

Hey guys I have a small question concerning css styles and javascript / jquery. Lets say i define the following css style. .myStile { padding: 5px } Now I'd like to access the property of padding while not writing an html element to the document. I came up with the following idea which only works with Firefox (IE and Chrome say NaN) ...

Javascript: detect when a window is resized ?

Is there any way with jQuery or javascript to trigger a function when the user ends to resize the browser window ? In other terms: 1) Can I detect mouse up event when user is resizing the browser window ? otherwise 2) Can I detect when a window resize operation is finished ? I'm currently only able to trigger an event when the user ...

How to encode JavaScript text inside an XML attribute?

I have a piece of JavaScript string, coming from an untrusted source, embedded inside of an onclick tag and I'm not sure what the correct way of encoding this string is. Here is a simplification of the HTML: <input type="button" onclick="alert([ENCODED STRING HERE]);" value="Click me" /> I use the Microsoft AntiXss library which c...

get to post google map gdownloadurl

hi all, this is the javascript. var url = "http://google.com/gmap.jsp?uid="+userid+"&amp;lat="+lat; GDownloadUrl(url,function(doc){}); how to change from get to post? any idea? thanks ...

Adding select menu default value via JS?

Hi, i'm developing a meta search engine website, Soogle and i've used JS to populate select menu.. Now, after the page is loaded none of engines is loaded by default, user needs to select it on his own or [TAB] to it.. Is there a possibility to preselect one value from the menu via JS after the page loads? This is the code: Javascrip...

Call a method on browser closing

I am facing an issue in my application when a user directly clicked on browser close [X] button. Browser can be IE, Chrome, Mozilla, Firefox and many more. What I want to do: 1. as soon as user hits [X] button of browser, need to set their status as logged off in database for which we have a method in Login.aspx file which is within the...

Soapheader in Scriptservice

Hi i recently added scriptservice to my asp.net 3.5 webservices. I am doing a direct http call to the webservice via Android(java) and getting back json. Thats working all nice and everything. Now i want to add securtiy to it so my normal way is to have a soapheader with a gen token or username password and theh https the webservice. I...