javascript

JSF OnClick commandbutton

How do I use Javascript to "click" on a CommandButton? I tried the following but it doesnt work: <ice:panelTab id="searchResultsTab" label="Search Results" onclick="document.getElementById('form:searchTabs:0:refreshButton').click();"> Thanks. ...

Detecting presence of a scroll bar in a DIV using jQuery?

I want to detect the presence of a scroll bar in a DIV using jQuery. I was thinking to use $('div').scrollTop() but that returns 0 in both cases when the scroll bar is at the top and when there is no scroll bar at all. Any ideas guys? ...

[IE 7/8] Loading HTML content in via Javascript nulls my <title> tag in some instances

This is an Explorer only problem and the symptoms are: I have links that when clicked will load in HTML chunks (none of which contain html header tags) using javascript. The html chunks are placed in various <div>s around the page, perhaps 3 different places with 3 different chunks brought in via javascript. When these chunks load in ...

JavaScript 1.6 Array.map() and Array.filter() not working with built in functions as arguments

This works fine: ["655971", "2343", "343"].map(function(x) { return parseInt(x) }) // [655971, 2343, 343] But this doesnt: ["655971", "2343", "343"].map(parseInt) // [655971, NaN, NaN] The same happens for Array.filter() What am I missing here? ...

How to determine if variable is 'undefined' or 'null'

How do I determine if variable is 'undefined' or 'null'. My code is as follows: EmpName = $("div#esd-names div#name").attr('class'); if(EmpName == 'undefined'){ ///DO SOMETHING///// }; ...

Javascript crc32 function and PHP crc32 not matching

Hello everyone, I'm working on a webapp where I want to match some crc32 values that have been generated server side in PHP with some crc32 values that I am generating in Javascript. Both are using the same input string but returning different values. I found a crc32 javascript library on webtoolkit, found here. When I try and match a ...

unfounded Secure Unsecure Messages

I'm having significant difficulty locating the root cause for a secure/insecure message comming from IE. I've looked through the entire output and there are NO references to http: I've searched for unsource Iframes, which cause this message, and there are none and other than jquery 1.4 there isn't even the text "iframe" in the source....

Using jQuery within a Opera user javascript

I wonder if its possible to load jQuery within a opera user javascript, so that i can use jQuery functionality in the opera user javascript even on pages that is not currently using jQuery. ...

YUI and/or jQuery for a new project?

If I am starting a new project how should I pick between using YUI 2, YUI 3 and jQuery? I know there are a bunch of questions/answers already about can you use them together, but I am trying to figure out what criteria I should be thinking about to make my decision. Are they overlapping? Is one better at GUI and the other better at in...

Submit to open up a popup window and carry through input data

Hi, I have a input box on one page that on submit opens a new page with a longer form and the first field is populated with what was entered from the previous pages input box. So on page 1 there is this code: <form action="sign-up.php"> <input type="text" name="email" value="sign up for email" onFocus="clearText(this)" onBlur="clearT...

Add "Become-a-Fan" button to my website

I am trying to add "Become-a-Fan" button to my 2008 asp.net website (vb) Here is an example i have followed http://www.docstoc.com/docs/9646635/Add-a-Facebook-Fan-Button-to-your-Website/ posted this following script to my website: <script type="text/javascript" src="http://static.ak.connect.facebook.com/connect.php/en_US"&gt;&lt;/scri...

How do I delete a '_' prefix on a variable using jQuery?

I have a variable that reads as _123456 and I need to delete the underscore prefix on this variable before storing it to a field. How do I do this? var value = "_123456" ...

A javascript variable used in multiple Web pages

Is there any way to define a variable that can be used in multiple Web pages? For example, a string variable stores a certain value in page A and that value can be accessed in page B. I know cookies can do it. Is there any other way? ...

Javascript get Function Name?

How can I access a function name from inside that function? // parasitic inheritance var ns.parent.child = function() { var parent = new ns.parent(); parent.newFunc = function() { } return parent; } var ns.parent = function() { // at this point, i want to know who the child is that called the parent // ie } var obj = n...

Frames with JavaScript

How can I manipulate using JavaScript (JQuery) a site, not in my server, that I loaded in a frame? ...

What does this Javascript mean? SRC is very strange looking

Hi, Sorry for the bad heading but I couldnt explain it better. im trying to make a trackback on a webshop that should allow me to send the order id, and the amount back to a page i control. The only way i can get anything on the confirmation page is by javascript. I looked at one of the examples that was there to begin with (another aff...

Escape apostrophe in aspx file

<asp:Button ID="myButton" runat="server" OnClientClick='confirm("How do you escape this apos'trophe?")' /> ...

How to disable <a onclick> when the user holds control.

Usually, when people click on a link, I have onclick bound to it. And then return false. When people click with "control", they expect a new page to open up. Therefore, I want to ignore the onclick AND/OR detect it. How do I do this? ...

What is the difference between a private and public function?

I am a new programmer, and I started in C and am now starting to enjoy JavaScript and a tiny bit of PHP more. Lately I've heard the terms 'private' and 'public' functions a lot. Could anybody give an explanation of the both and how they are of use to a programmer? And I'm probably totally wrong here... but is a (function(){}) in j...

Javascript Intellisense not working on Visual Studio 2010 Ultimate (Windows 7 x64)

Hi guys, I've just got the new Visual Studio 2010 Ultimate and Javascript Intellisense is not working on .aspx/.ascx files inside blocks. It does work on external .js files. After VS2010 setup, it asked me if I wanted to import the settings from previous VS version (I have VS2008 SP1 installed), I say yes. I've tried resetting the se...