javascript

Passing variables and data through a regular web page link?

I'm working with a page where I'm trying to submit data when a link is clicked. I already know how to do this with POST and GET using javascript buttons, but how do I get the same effect when I'm working with HTML links? ...

What options are available for documenting your Javascript code?

Is there something like dOxygen/Javadoc? What has everyone used out there that has worked well? ...

Custom scrollbars

Hey everyone, I'm working on making an application with adobe air and I have a div that uses overflow-y. In order for the UI to look nice and sexy, what's the best way to replace the ugly default scrollbar with a creation of my own? Thanks EDIT: Everyone remember that this is on adobe air, not on a browser (I know better than to to me...

execute function on completion of another, use ajaxComplete()?

Hi there, two functions need to be executed in Javascript, the second one only after the first has finished. The first populates an array with getJSON, and the second will then manipulate it. However, getJSON is asynchronous, thus it will not pause the order of execution to make the program work properly so that the array finishes load...

Javascript focus measurement

I'm looking for a Javascript library to be able to measure the time a div (or any other object) has been in "focus" (as in: the browser is showing and the window is focused; not the normal Javascript focus event). Do you know if something like that exists ? or something similar I can tweak? Edit: Ok. Rephrased to avoid misunderstandin...

Javascript Cookie onload Call

I have a cookie that I did using javascript and to check if it had to be replaced I used "onload=checkCookie()" in the body tag of the HTML, however now I'm trying to place the js in another file and just link it using the tag, but if I do that I can no longer call this function using just "onload" so I was wondering how can I do this? ...

Why this kind of function invocation is wrong in JavaScript?

I'd like to create an anonymous function and then invoke it immediately. 1) This will bring a syntax error. Why? function () { alert("hello"); }(); 2) wrap the function definition with () and it works. (function () { alert("hello"); })(); 3) or, assign the anonymous function to a variable. It works. var dummy = function()...

Javascript Datejs

I was looking through some pages when I stumbled across this open source JavaScript date library: Datejs. Now I've been trying to use it but everytime I try any function like: $(function() { Date.today().toLongDateString() } ); or even only Date.today().toLongDateString() withing tags, I get errors when the webpage loads, it tells...

And Or stacking conditions in Javascript (if $1 && ($2 || $3))

For example. there are 3 variables, 1 is a must, 2 and 3 are eithers so 3 can be false as long as 1 and 2 are true, 2 can be false as long as 1 and 3 are true. if(xmlhttp.responseText.indexOf("type:SearchList~")>=0 && (obj == "hDrop" || obj == "iDrop")){ } Isn't working for me Can anyone spot the problem? ...

Multiple WMD editors (SO forked version) on one page?

Hi folks, To be clear, I'm referring to the usage of stackoverflow's forked WMD, not the original version from attacklab. I'd like to use the forked version, however it seems that the div id's which are used by the script to identify the page elements to WMDify are hardcoded in wmd.js:66: // A collection of the important regions on t...

Why is it common to create toolbar with tag <UL> and <LI>?

I found that quite a few "toolbar" in web page is implemented with HTML tag UL and LI with style "float:left". Fore example, with the help of FireBug it is easy to find this pattern in http://www.yahoo.com/. Is there any reason for that? I don't think that UL and LI are invented to create toolbar. ...

Should We Use Long-Name Or Short-Name in JavaScript Coding?

There is a discussion about JavaScript coding in my work group. Some people argues that we should use long-name for better readability; the others believes that short-name should be favored to same bits-on-wire. Generally, it is about coding convention. One side believes that identifier such as "fAutoAdjustWidth" is OK, while others pre...

Using javascript with the twitter API

Hey everyone, I'm interested in making a twitter client using Adobe Air, but I'm kinda stuck right now, as I can't figure out a better way to connect to the twitter REST API since it needs authentication. Currently, the client sends a request to my server (a php script using curl) with the twitter username/password (unencrypted) in GET...

Transparent google gears scenario validation

I want to use google gears, not for functionality but for optimization. I.e. if gears is detected in the browser side, then we will silently use it to do some optimizations and caching in the client side. If it isn't installed we silently work against the server only. Somewhere in the FAQ or help pages of our website we will tell the u...

Elgently ignoring netscape.javascript.JSException during development

Hello, Eclipse allows you debug applets using sun.applet.AppletViewer. It will actually start the applet, run it and emulate complete browser runtime. If you have javascript manipulation code in your applet this will cause JSException because the present context is not a real JS enabled engine. How would you solve this issue? I can see...

Multiple control instances using jQuery and ASP.NET controls

<script type="text/javascript"> $(document).ready(function() { $('#pHeader').click(function() { $('#pBody').slideToggle('fast'); }); }); </script> <asp:Panel ID="pHeader" runat="server" CssClass="cpHeader"> <asp:Label ID="lblText" runat="server" Text="Header" /> </asp:Panel> <asp:Panel ID="pBody...

Cross-domain AJAX With ActiveXObject on IE

Hi, Using the ActiveXObject object on IE. How can I submit a cross-domain request? ...

Js write with no blank page

hey I know I may seem like a complete fool for asking this question but I truly have never known and nothing I find helps me. I have this string generated using javascript and I want to append it to my existing web page on the fly. I've used document.write(); or just document.getElementbyId('').append(); and I just can't get it to append...

highlight text in html with javascript jQuery

I want to highlight all the keywords (case insensitive) within a p tag programatically if the keywords are var keywords = "hello,thanks, goodbye" // this should be an array <p>hello world</p> hello should be highlighted in blue ...

How to load javascript intermixed with html

So I need to pull some javascrit out of a remote page that has (worthless) html combined with (useful) javascript. The page, call it, http://remote.com/data.html, looks something like this (crazy I know): <html> <body> <img src="/images/a.gif" /> <div>blah blah blah</div><br/><br/> var data = { date: "2009-03-15", data: "Some Data Here...