javascript

Can I cut and paste structured data in Browsers via Javascript?

My users work with a dozen web applications. Over some I have complete control over others only limited via templates and Javascript (e.g. Zendesk). Between these Applications I want my users to be able to copy and paste structured data. With structured date I mean for example an address encoded as vcard/hcard. So when somebody "copies"...

FB.ui does not work inside FB canvas. HELP!

This code works in a standalone HTML file, as well as in the index page of my iframe FB app. I get the FB.ui box correctly. But if I redirect from index to another page, and have the same code there, it doesn't work. I get all 3 alerts, but FB.ui doesn't show up. HELP! I've tried both display:'dialog' and display:'popup' but no effect ...

How to update asynchron pages upon event from other client?

Hey there, I'm currently fooling around with AJAX. Right now, I created a Markdown previewer that updates on change of a textarea. (I guess you know that from somewhere... ;-) ). Now, I'm trying to figure out, how to update a page upon an event is fired from another client. So to say an asynchron message board. A user writes something,...

Mootools referring to wrong element?

Here's the logic: - Use JSONP to generate a list of articles - When the user clicks the title, do another JSONP req. and generate the content by replacing the subtitle from the previous request. That's all nice and dandy, but this is what happens: - I click a random article title, content replaces subtitle (works great) - I click a seco...

Loading dropdownlist on click of the dropdown's arrow/lazy loading of dropdown

Hi all, I have a situation where on a page there are 7-8 dropdowns, which have large amount of data to be binded. I have a radiobutton list having 2 choices and on selecting any of them, the i get the data from cache and bind all the dropdowns which takes about 6-7 seconds.But, i dont use all the dropdown everytime as basic functionality...

Is it possible to add a browser code in javascript

Hi, I would like to create a webpage with browser specific in javascript. For example: can I use code like this in my coding part chrome.tab.onRemoved.addListener() in my webpage. If it is possible please suggest me. ...

Load website in iframe dialog, save open and close time, jquery

Hi, I found an example that shows how to load a website in an iframe using jquery, link My question is, is it possible to get a timestamp of the opening and closing event of dialog that displays the iframe? ...

Active item menu RoR

Hello. How I can get active item menu? Menu generate in cycle <ul id="menu"> <% for page in Page.roots %> <li><%= link_to h(page.name), page %></li> <% end %> </ul> I want use other css property for this item. Any ideas? Preferably js, jquery... ...

How to get a list of all elements that resides at the clicked point ?

On user click I would like to get a list of all elements that resides at the clicked point. For example, if user clicks on Hello here: <div><span>Hello<span></div> I would like to get the following list: <span> element <div> element <body> element <html> element What would be the easiest method to get these elements ? ...

how facebook controls #! in url

how can i controls #! in url suppose i have the following url http://www.facebook.com/#!/video/video.php?v=1106030301789 now how facebook controls that #! in url.... ...

How many JavaScript programs are executed for single web-page in the browser?

JavaScript programs consist of statements and function declarations. When a JavaScript program is executed, these two steps occur: the code is scanned for function declarations, and every func. declaration is "executed" (by creating a function object) and a named reference to that function is created (so that this function can be calle...

JavaScript Function eval() throwing an out-of-stack quota exception

Hey all, Recently I ran into a problem: Valid JSON when passed to the eval() function causes it to throw the error -- "script stack space quota is exhausted". It is consistently reproducible, and through initial examination, it seems that this is a limitation on the number of object attributes/properties that can be defined (and not th...

mootools show/hide div dependent on whether or not checkbox is checked

I have a checkbox I wanting to show a fieldset in a form dependent on whether or not the checkbox is clicked or not? i.e if the checkbox is checked don't show the fieldset and if it is not show the fieldset. My markup looks like this, <fieldset class="toplined"> <label>Keep Image</label> <input type="checkbox" name="update_image[]" va...

Refactor $(document).ready(), currently have 2 instances.

Hi all, I've got following JavaScript functions but want to refactor the $(document).ready() as I've got 2 instance of it. How can I achieve this? FlashMessenger = { init: function() { setTimeout(function() { $(".flash").fadeOut("slow", function () { $(".flash").remove(); }); ...

How to delete only cookies set for .domain.com ?

Is there any way to tell if a cookie is set for .domain.com rather than www.domain.com? A solution in either client-side JS or server-side PHP would be OK. What I would like to do is delete any cookies set for .domain.com, because I have recently set up static.domain.com for static content, and I don't want cookies being sent to the sta...

Is it ok to keep on updating Date Time using Javascript's setInterval method?

I am using Javascript's setInterval method to keep on updating the time of the Client computer. This is my code: $(document).ready(function() { setInterval(function() { setCookieForDate(); }, 500); }); function setCookieForDate() { var cookie_date = new Date(); var serverDateTime = '<%=DateTime.Now%>'; document.cookie =...

Javascript Syntax Error

Can anyone figure out why this is throwing a syntax error? All of the code looks correct to me. <script type="text/javascript"> var rootdomain="http://"+window.location.hostname; function ajaxinclude(url) { var pagerequest = false; if (window.XMLHttpRequest) // if Mozilla, Safari etc pagerequest = new XMLHttpRequest(...

JSLint Expected '===' and instead saw '=='

Recently I was running some of my code through JSLint when I came up with this error. The thing I think is funny about this error though is that it automatically assumes that all == should be ===. Does that really make any sense? I could see a lot of instances that you would not want to compare type, and I am worried that this could ac...

jQuery ~ Two click events overlayed?

I have a container element say <div id="myContainer"> <form action="" method="post"> Radio: <input type="radio" name="myRadio" id="myRadio" value="1" /> </form> </div> So if I assign a click event to the $('#myContainer') and also a click event to $('#myRadio') is there a way to get them both to fire? Currently, because there i...

JavaScript - Invoking Methods that Reference this

Not sure what I'm doing wrong here, I just want to be able to have functions of an object reference the object scope myscipt.js function MyFoo () { this.name = 'myname'; } function MyBar () { this.myFoo = new MyFoo(); function setMyFoosName( name ) { this.myFoo.name = name; } } somepage.html <scipt> $('document'...