javascript

firebug reporting reference to undefined... jquery.cache [id] [name]

I am trying to learn javascript/jquery, using firebug to debug and have built a page, which I have reduced to a minimal below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <script src="jquery-1.3.2.js" type="text/j...

Close popup window if it exists

Hi, With some javascript I openup a popup no prob using: function myPopup2(x){ if (x==1) { myWindow = window.open( "timer.html", "", "height = 150, width = 300" ); }else { myWindow.close(); } } I then run some PHP script which refreshs reloads the page. When I later then go to close the popup - it...

How can I define a function's prototype in JavaScript?

How can I define a function's prototype in JavaScript? I want to do this like I would do it in C where you would do something like: void myfunction(void); void myfunction(void){ } So is there any way to do this in JavaScript? I'm asking this because of the function declaration order that is required in JavaScript. Edit: I have an...

Can I do a TextBox Validation after an outclick event?

I have a javascript restricted calendar on a textbox, which prevents the user from selecting any more than 2 months prior. If the user manually enters the date and not select from the calendar, they can get past it. How do I do a Validation on a outclick, or tab event to check my conditions? ...

Detecting the exact moment an element appears in the DOM

Is it possible to detect the exact moment an element exists in the DOM on page load? Context: On page load i hide an element of my page using jQuery (i.e. If JavaScript is available i want to hide the div) but on poor internet connection you see the panel for a second or so before it disappears. I'd like to hide the element as soon as ...

How performance-hungry are events in Prototype (JavaScript)?

Does anyone know if using custom events in Prototype (using Element.fire and Element.observe ) affects performance? Also would I gain performance if I use global variables instead of events? Thanks! ...

Why does Bing obfuscate their JavaScript?

I was surfing the web, as usual and I wanted to take a look at Bing's source code because I was curious and wanted to know what they were using to make their image fade in. I was surprised by what could only be qualified by the following line : Holy wall of text! And it made me wonder if there is any advantage to obfuscate your (X)HTML...

Select not Selected

I have a form with 4 dropdowns on it. The default selected option in all the dropdowns is "Please Select". I want to use Jquery to make sure all dropdowns have a value before the page is submitted, but my code only works on the first one. Does anyone have a way that I can check all of the dropdowns at once? function doconfirm() { if (...

jQuery Validation plugin error messages at END of list for checkboxes

Hello all. I am using the Validation Plugin for jQuery and it works wonders. Except when I have a group of checkboxes...the error messages will display right after the first box...like so and that is after I have created a "hidden" checkbox at the beginning of the group. Is there anyway i can make it display after the LAST checkbox? Is ...

JavaScript Function in HREF vs OnClick()

I want to run a simple JavaScript function on a click, that is NOT a redirect. Is there any difference or benefit between putting the JavaScript call in <A HREF="javascript:my_function();window.print()" ></A> vs. putting it in the onclick event? ...

Should I be encrypting contents of browser / javascript memory?

This is a security best practice and I'm wondering if I should even be wasting my time with this. In the same vein of an initial crack of the Blu-ray movie format, hackers just inspected the memory of a player to snoop out a key value. It seems like it's feasible to do the same thing with browser memory, and to look at values that th...

Can I do a Date Check on a TextBox with a onBlur event?

I want to do a Date Check on a TextBox with a onBlur event. I am not sure how to check the textbox in javascript on the aspx side. This is what I have so far TodayDate= new Date(); function checkEnteredDate() { if (document.getElementById('txtDate') > TodayDate) { alert("You cannot select a date later than today."); document.getElement...

How to open a new window in Google Gadget?

It opens neither a tab nor a window: the code for a Google Gadget here. If you know 'target="_blank"' from HTML, I am looking for a similar tool for Google Gadgets. More precisely, I cannot understand why the JavaScript piece does not work: window.open("http://www.google.com/"); ...

How to save current state of OFFSET in SQL

I have 1000 rows of data but need to only display 100 rows at a time. I would like navigation buttons (like on google next, prev) to go thought the groups of 100 My C cgi application runs and exits every new query, so it can't save states. Question is: What is the most efficient way to save the current state of the OFFSET, so I can n...

call javascript from python

I want to execute this script (view source) that uses Google Translate AJAX API from python, and be able to pass arguments and get the answer back. I don't care about the HTML. I understand I need to embed a Javascript interpreter of some sort. Does this mean I need to have a browser instance and manipulate it? What is the cleanest w...

Problem with indexOf on JavaScript array

var allProductIDs = [5410, 8362, 6638, 6758, 7795, 5775, 1004, 1008, 1013, 1014, 1015, 1072, 1076, 1086, 1111, 1112, 1140]; lastProductID = 6758; for some reason I get a -1 or I guess which is equivalent to not found for this: alert(allProductIDs[allProductIDs.indexOf(lastProductID)); I can't figure out for the life of my why becau...

Is it possible to hide the cursor in a webpage using CSS or Javascript?

I want to hide the cursor when showing a webpage that is meant to display information in a building hall. It doesn't have to be interactive at all. I tried with the cursor property and a transparent cursor image but I didn't make it work. Does anybody know if this can be done? I suppose this can be thought as a security threat for a use...

How to capture a website API traffic data with Google Analytics?

I have a website where most of the traffic comes from the API (http://untiny.com/api/). I use Google Analytics to collect traffic data, however, the statistics do not include the API traffic because I couldn't include the Google Analytics javascript code into the API pages, and including it will affect the API results. (example: http://u...

Retrieve text from TextArea!

Hello again and thanks for your effort! Since my previous question wasn't successful I thought I'd give it another approach.So the basic idea is to update my calendar event on mysql: $eventQuery = mysql_query("SELECT id, body FROM tblCalEvent WHERE id= '$eid'", $conn); which sits separately on a PHP file and works fine by returning...

getElementById problem

I call the following function with a mouseover event but it's not working. My id's are all correct & I have properly linked all my external scripts. function new2() { var prevWin = document.GetElementById("recentlyaddedtip"); prevWin.style.visibility = "visible"; } recentlyaddedtip is set as hidden in the stylesheet (and it properly c...