javascript

Is it possible to programatically catch JavaScript SyntaxErrors?

I don't think that this is doable, but wanted to throw it out to the community to confirm my suspicions. Let's say you're writing a program in another language like Python, PHP, or ASP. This program is intended to build another program written in JavaScript. However, the first program is unfortunately not immune to errors. So, occ...

jQuery selector not working in IE

sample html: <tr> <td class="hidden tblLnk">8163</td> </tr> <tr> <td class="hidden tblLnk">8163</td> </tr> <tr> <td class="hidden tblLnk">8164</td> </tr> this method should return a unique array of text from rows with a specific td class. { 8163, 8164 } in our sample. works in ffs and chrome but not in ie8 or safari. ...

Javascript cookie not working on form submit

I have a form like this: <form id="loginCompact" action="https://ppe.gamingsystem.net/customerauthn/pl/login" name="sportsbook" method="post" onsubmit="createCookie('BRLOG', document.sportsbook.username.value, 1)"> <input type="text" name="username" class="loginUsername" /> ...other fields... </form> And this is the Javascript...

Strange jQuery $(window).load() behavior in Safari

I have a page being loaded in an <iframe>. Inside the <iframe>, I have a function that patiently waits for the page to load using jQuery's $(window).load() event which is supposed to wait until ALL page content (images, javascript, css, etc.) is loaded before firing. The function then calls back to the page loading the <iframe> using p...

Why is it that on IE7, my javascript file does not work?

No functions get called, and I can't even alert. It is just an external javascript file. However, everything works on Firefox, Chrome and IE8. I am using Django/python backened to serve this file. Is this a known bug from IE7? ...

how to select all childs other than a element

I have a element which contains 3 child. let says <div class="parent"> <div class="firstChild">firstChild</div> SecondChild <ul><li>thrid child</li></ul> </div> In the example I need to select first 2 childs and not the UL. how to do through jquery. ...

Variable not evaluating in JavaScript?

Can anyone tell me how do this? They are already integers, so I'm not sure what to try... var lrgSlideShow = { activeClass: 'active', wrapperClass: 'slideshow-widget-large', pauseLength: 2000, fadeLength: 1000 } setInterval(changeImg,lrgSlideShow.pauseLength+lrgSlideShow.fadeLength); ...

openDatabase Hello World - 2

This is a continuation from a previous stackoverflow question. I've renamed some variables so that I can tell what are keywords and what are names that I can control. Q: Why is the deleteRow function not working? <html> <head> <title>html5 openDatabase Hello World</title> <script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; <sc...

Dynamically Forming a JSON object traversion without using eval.

Given I have the following: (which is dynamically generated and varies in length) associations = ["employer", "address"]; Trying to traverse the JSON object, and wanting to form something like the following: data.employer.address or data[associations[0]][association[1]] Without doing this: eval("data."+associations.join('.')); F...

Iframe changing according to javascript and php

hi everyone! I'm attempting to reload an iframe when a onChange event occurs heres what i got in javascript tags in the header ` function getSchedule(oEvent) { var n = document.getElementById("wantedTherapist"); var newn = n.options[n.selectedIndex].value; window.frames['schedule'].src = "schedule.php?therapist="+newn; }...

I have a standard table with text inside. How do I vertical align this?

Right now, the text seems not to be exactly vertical centered. It seems that there is more top-padding than bottom-padding. Although of course, there is no padding in the CSS. How do I make this completely vertical aligned? ...

Programming image maps

Hello, I am looking for a javascript/jquery solution to build a map with selectable tracks. It will consist of area's map (image) with some river routes for boats that have to be selectable - route have to be made clearer on mouse hover and after user clicks on a route a popup window should emerge. Basically I am just looking for a solut...

How do I do this <a href>?

http://www.twitter.com/home?status=Check out my page! However, when it goes to the twitter page, it has %20 symbols replacing the spaces. Why? ...

How to subclass a specific jqueryui widget method ?

Since I updated jQueryUI to 1.8 I found a couple of issues in our implementations and I could fix it myself without waiting for a fix on their end if I could find out how to subclass a specific method of the datepicker widget so I call the parent code and then execute my code. I was reading on $.widget but I just can't wrap my head arou...

How can you see what functions and variables are currently defined in javascript?

There's a function in PHP where you can get a list of the user defined functions that are currently defined, is there something similar in JS? I'm trying to see a list of functions in Firefox 3, with Firebug enabled. =/ so far none of the answers work out of the box ...

Why is Javascript's Math.floor the slowest way to calculate floor in Javascript?

I'm generally not a fan of microbenchmarks. But this one has a very interesting result. http://ernestdelgado.com/archive/benchmark-on-the-floor/ It suggests that Math.floor is the SLOWEST way to calculate floor in Javascript. ~~n, n|n, n&n all being faster. This seems pretty shocking as I would expect that people implementing Javascri...

Jquery and binding an event to an iframe

**I'm currently using a jquery textselect plugin to fire alerts based on the selection text anywhere on the page and it works just fine doing something like: $(document).ready(function() { $(document).bind('textselect', function(e) { alert(e.text); }); }); I've since had to add an iframe to the page and I need the te...

How can I create a <a href=> to facebook and share a message?

I don't want to share my PAGE, but I want to share a message with a short URL link to something. ...

Undesired "flashing" in Jquery dropdown menu?

Hi, I've got the following piece of Jquery: $("#collapse-menu > li > a").click(function() { $(this).toggleClass("expanded").toggleClass("collapsed").find("+ ul").slideToggle("medium"); }); What it basically does is expands or collapses a menu of nested "lists" which contain dropdowns (simplified example): <ul id="collapse-menu">...

Saving js file with c# commands...

<head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/css/layout.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/Areas/CMS/Content/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" ...