javascript

Calling JavaScript from function from CSS

Is there any way that I can call my JavaScript function from css? For ex here is style: .first-nav li a:hover, .first-nav li.hover a { margin:-3px 0 -1px; height:30px; position:relative; background:url(../images/nav-hover.jpg) no-repeat; } and I want to call a JS function on anchor hover. ...

Is there any public javascript version of the Wikimapia "add place" functionality?

Hi! I'm wondering if the Javascript functionality Wikimapia.org has for adding a new place (Goto Edit Map -> Add Place) is public available? I want this functionality but place in on my own pictures and div's (to create some kind of custom imagemaps or something like that). Is this possible or is there anyone that can reproduce this f...

Post-loading : check if an image is in the browser cache

Short version question : Is there navigator.mozIsLocallyAvailable equivalent function that works on all browsers, or an alternative? Long version :) Hi, Here is my situation : I want to implement an HtmlHelper extension for asp.net MVC that handle image post-loading easily (using jQuery). So i render the page with empty image sources ...

onfocus="this.blur();" problem

// I am trying to apply an "onfocus="this.blur();"" so as to remove the dotted border lines around pics that are being clicked-on // the effect should be applied to all thumb-nail links/a-tags within a div.. // sudo code (where I am): $(".box a").focus( // so as to effect only a tags within divs of class=box | mousedown vs. onfo...

Prototype setStyle not working in IE6.

Hi, I'm using prototype and setStyle in IE6 is just messing everything up. It's throwing a big error. I've Googled it but cant find a solution. I've identified the line in prototype with the IE script debugger, it's the final else block: setStyle: function(element, styles) { element = $(element); var elementStyle = element.st...

How to invite users to connect to your application using Facebook Application Development interfaces

I think that this question already questioned, and probably the answer is here: http://wiki.developers.facebook.com/index.php/Notifications.send but the real problem is that facebook says: Facebook discontinued support for this method March 1, 2010. Calling this method returns error code 3 -- Unknown method. while, I couldn't find any ...

Print/save full webpage as PDF

I need a method to be able to print/save the current full webpage as a PDF. I know it can be done if I download a PDF printer and print to that; but I need it to be done without the user having to do anything other than click a button in a webpage. I can't do it via PHP as the page is all client side content, so I'm guessing an ActiveX...

Hiding a dropdown menu without it flashing with prototype

I have a number of dropdowns and divs that are hidden when the page loads and can be toggled with a click or mouseover, but some of them flash b/c the javascript does not run in time. I have their display initially set to block and then I use javascript/prototype to find the element and hide it. I have tried loading these "hider" funct...

If you select an element in jQuery by ID is there still a speed improvement by giving it a context?

Imagine this simplified markup: <div id="header"> <!-- Other things.... --> <div id="detail"> </div> </div> and assume you already have this code: var $hdr = $("#header"); Is there any speed difference for jQuery to lookup "detail" this way: var $detail = $("#detail", $hdr); vs var $detail = $("#detail"); Since deta...

Zend Framework - tinyMCE - plugin folders are mistaken to be controllers? Help

Hi guys I'm trying to integrate the tinymce plugin however I'm running into problems such that almost every feature which requires a plugin to be rendered i.e the add url popup or add image pop up - it opens an empty pop up window. Even if I try to open it inline I get the same blank popup window.. I noticed that whenever I click on lets...

Javascript Mouseover bubbling from children

Ive got the following html setup: <div id="div1"> <div id="content1">blaat</div> <div id="content1">blaat2</div> </div> it is styled so you can NOT hover div1 without hovering one of the other 2 divs. Now i've got a mouseout on div1. The problem is that my div1.mouseout gets triggered when i move from content1 to content2, because the...

Caching issue with javascript and asp.net

Hi guys: I asked a question a while back on here regarding caching data for a calendar/scheduling web app, and got some good responses. However, I have now decided to change my approach and stat caching the data in javascript. I am directly caching the HTML for each day's column in the calendar grid inside the $('body').data() object, ...

Remove/hide browser address bar or toolbar web page

Hi All, I am creating web page using asp.net. Is it possible to remove/hide the browsers address bar or toolbar using Javascript for IE. Nathiya. ...

javascript removeChild() and appendChild() VS display=none and display=block|inline

I'm developing a web application that shows some controls and descriptions dinamically (I don't want to use jQuery or other libraries). At this moment i make appear and disappear controls using: element.setAttribute("style", "display : inline"); and element.setAttribute("style", "display : none"); but i'm thinking about using: ele...

JavaScript decimal value validation

I want to validate a decimal value in an ASP.NET web page using JavaScript, so that the user can enter numbers with only two decimals. The validation should also consider the current UI culture (e.g. ',' instead of '.'). I use Microsoft's Ajax Framework, is there any function included in the library for such a thing? ...

Is there a Javascript equivalent of .NET HttpWebRequest.ClientCertificates?

I have this code working in C#: var request = (HttpWebRequest)WebRequest.Create("https://x.com/service"); request.Method = "GET"; // Add X509 certificate var bytes = Convert.FromBase64String(certBase64); var certificate = new X509Certificate2(bytes, password); request.ClientCertificates.Add(certificate, "password")); Is there any wa...

AJAX with Ruby on Rails?

This is probably a really dumb question with a simple answer but... I am working on a project where I need to use AJAX to send/receive information. I am using Ruby on Rails (which I am pretty new to), but rather than using the helper methods or the built in functionality in the 'defaults' Javascript file, I need to do this manually in m...

JQuery method for IFrame functionality

I have a aspx page (details page) that needs to be loaded in a modal window on a click of a button. I have buttons in the aspx page that calls server side functionality. So, this is similar to an IFrame way (except that it's now in a modal window) Is there a JQuery way of doing this? It appears that the JQuery load loads only fragments ...

JavaScript - string regex backreferences

You can backreference like this in JavaScript: var str = "123 $test 123"; str = str.replace(/(\$)([a-z]+)/gi, "$2"); This would (quite silly) replace "$test" with "test". But imagine I'd like to pass the resulting string of $2 into a function, which returns another value. I tried doing this, but instead of getting the string "test", I...

Get content from HTML element in Rails

Hey, I'm looking for a way to get the content of my div in my Rails view. I would like the literal HTML content, so only HTML and no Rails I thought inner_html would work, but I get a RJS exception (TypeError: $("content").innerHtml is not a function) Does anyone know how I can get the content? Thanks! In my controller I use this c...