unobtrusive-javascript

Calling javascript from sifr replaced anchor tags?

I'm using sIFR to replace my navigation text with a new font: <ul> <li><a href="#">about</a></li> <li><a href="#">reel</a></li> <li><a href="#">contact</a></li> <li><a href="#">archive</a></li> <li><a href="#">login</a></li> </ul> sIFR.replace(futura, { css: [ '.sIFR-root { background-color:transparen...

Unobstrusive JavaScript for Digg button?

I want to add the Digg button on my webpage but don't want to add the script tag directly on the page. <div class="digg"> <script type="text/javascript"> digg_url = ''; digg_bgcolor = '#99ccff'; digg_skin = 'compact'; digg_window = 'new'; </script> <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></...

How to generate different links on web page if JavaScript is enabled?

I am trying to follow tecnhique of unobtrusive JavaScript / graceful degradation. I'd like to serve page with different links when JavaScript is turned on, and when JavaScript is turned off. For example when JavaScript is turned off the link would be <a href="script.cgi?a=action"> and when JavaScript is turned on <a href="script.cg...

<select> tag reposting

After several failed attempts using ExtJS I have now decided to use javascript.The requirement is to assist a combo box in select tag.If the list contains aa,aaa,aab,abc,bac,cba then if I type 'ab' continuously then it will select 'abc'.Whereas if I type 'a' time gap and then 'b' it will select 'bac' instead of 'abc'. Can anyone tell me...

Disable link with the prototype observe method...

I want to create a link like this: <a href="http://example.com"&gt;text&lt;/a&gt; and replace the behavior so that the link downloads the content with Ajax instead when clicking. It is important for me not to replace the href attribute (so copying the link still works). One solution would be to do: $('link').onclick = function() { ...

Unobtrusive JavaScript with server side values, best practice?

I'm used to do doing things like this: <a href="Javascript:void(0);" onclick="GetCommentForGeneralObservation(<%# Eval("ID") %>)"> That would be in a repeater or such like btw. However I an now trying to use unobtrusive JavaScript and hence get rid of any JS in the markup. I was trying to figure out what the best practice is in case...

Unobtrusive Javascript Obfuscates Event Handling

You know what I liked best about obtrusive javascript? You always knew what it was going to do when you triggered an event. <a onclick="thisHappens()" /> Now that everybody's drinking the unobtrusive kool-aid it's not so obvious. Calls to bind events can happen on any line of any number of javascript file that get included on your pa...

jqueryui without javascript

Does anyone use jQueryUI (such as the CSS framework part) without the jQuery component? If you were catering for users who don't have javascript or who have it disabled etc A particular scenario would be the dialogs which are so brilliant and simple...without javascript its just a div though...would a potential solution be to have the d...

Do you plan for javascript being off?

I'm coding a fairly large and complex site by myself, so do you think I need to support javascript being turned off? Its a lot of extra work supporting full page postbacks for stuff I could quickly do with JSON and ajax. ...

Singleton Pattern with {}?

I apologize to move it from here as there was some confusion and thanks to Grey for answer this to realized the mistake. The topic has been moved to http://stackoverflow.com/questions/1612703/how-to-design-an-object-on-singleton-pattern-in-javascript to discuss further. Singleton Pattern with '{}'. Here how it is: var A =...

Why do the Rails helper methods prevent "unobtrusive JavaScript"?

I heard Ryan Bates say that the Rails JavaScript helper methods prevent "unobtrusive JavaScript". Is this correct and, if so, could someone explain why? ...

how to use ajax link in a ajax return HTML unobtrusively

I have a page, with ajax URL on it, ofcourse this page is applying unobtrusive javascript, let's call this page A. <div id="pageA"> <a href="additem?id=1>Add this item</a> </div> <div id="items"></div> when i click that URL page B return a div with a URL that suppose to be ajax link. the return something like this: <div class="i...

Javascript validation For .net dropdownlistbox control?

i have 3 dropdownlistbox.. 1.country 2.state 3.cities when i am seleting country name.. as per it..state name and city name change. in that if i am changing state name then city name is changed in dropdownlist box.. using only javascript not postback of .net control. i have faced so much problem by making array of country,states and ...

Javascript: Event Listener mouseout

Hi guys, let me explain my problem. I have a mouseout event assigned to a div tag with an id of calendar. Now when this handler is called (when the mouse is not over the calendar div), i want to wait 2 seconds, then see if the mouse is still not over the calendar div. If the mouse i still out then do a function, if not then do nothing....

how to prevent conflicts between mooTools and Prototype

Hi All, I know that jQuery.noConflict() is used to avoid conflict between $ of any other library and jQuery.(i.e. Prototype) But lets say, by any chance I am using Prototype, MooTools and jQuery.In that case jQuery.noConflict() will work fine for jQuery and any other library combination, but then what with Prototype and MooTools, if the...

how can we perform reset function in master page of aspx page?

function reset1() { alert("123"); document.form1.reset(); return false(); } i want to reseting controls of master page.. using javascript but.it doesnt word properly.. can anyone help me to get through... Above is the function of reset which i used..for reseting.....

Using Javascript to Measure the Current Window

Ok, so I'm trying to build a website in which a large picture is the background. I want to be able to load a different size picture based on the user's window size so they (hopefully) don't see any blank space. I want to use JavaScript to measure the size of the current screen. Then, based on the size of the window, I would like to load ...

trigger jQuery function after location.reload() completes

I have a Rails app that allows users to login via jQuery modal form. Once logged in, I refresh the original page using location.reload(). At this point, I'm attempting to create a new jQuery dialog. How can I open the dialog only after location.reload() has finished executing? Right now the dialog is loading up before location.reload...

google.load issue

Hi I am messing around with google ajax api at the momemt and following the examples from the documentation I have two script tags in my html file: <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script language="Javascript" type="text/javascript">google.load('search', '1');</script> All works fine, but it...

Can the browser selectively request resources from a website?

I'm trying to dissect some well designed sites, in order to learn more about unobtrusive JS. One problem I am experiencing is that one technique for unobtrusive/graceful degradation seems to be loading a base HTML page and heavily modifying/appending elements with JS. It would be good if there was a tool where I could just selectively l...