javascript

Location of head.phtml in Magento

I am working with Magento and need to remove a Javascript that is being included in the <head> section by default. I am using a modified theme called modern. I am looking for head.phtml in: app/design/frontend/default/modern/template/page/html/head.phtml It does not exist. I do have header.phtml and footer.phtml. The code from header...

jQuery trim and remove on parent break child events

Note: I have a workaround to this problem, but I'd prefer to comma-separate the values as I describe below rather than separating them with spaces (which is what my workaround does). I have an ASP.NET website that allows instructors to choose from a DropDownList of preset comments and apply these comments to students in their classes. I...

Best getComputedStyle() scripts?

I've heard of a few scripts that can return the computed/rendered style of an HTML element. I've found that simply using currentStyle and computedStyle will often be buggy. In addition, simple scripts that find the total offsetLeft/Width will go awry in many cases. Instead of trying to reinvent the wheel (if one exists at all), what are ...

Selecting an html radio button dynamically through javascript does not work in IE

Hi, I want to select a radio button from javascript. I am using this simple html file to test the issue. The code below works correctly on firefox and chrome, however it does not work in IE (no version works). I would like to know why the supplied code does not work on IE, and how to select a radio button in IE? <html> <head> <scri...

jquery toggle the votes like stackoverflow

i have this voting jquery script, which works fine, but i want the option for the user to toggle the vote, just like stackoverflow, so basically you can vote up by clicking up arrow increase vote by 1 if they click again on the picture(arrow up) minus 1 from the vote my jquery script: $(document).ready(function() { $('.s...

Handling HTML SELECT Options with event delegation to javascript on iPhone Safari

We are developing a web application with GUI customized to use on iPhone. A page on the app has 3 subsequent SELECT dropdowns, where selection of an option from 1st dropdown derives the options for 2nd dropdown, and so forth. The subsequent dropdown options are populated by javascript based on onchange event on previous dropdown. The pr...

JavaScript Pass Variables Through Reference

Hello! Is there an equivalent in JavaScript for PHP's reference passing of variables? [PHP]: function addToEnd( } $myVar="Hello"; addToEnd($myVar," World!"); print $myVar;//Outputs: Hello World! How would the same code look in JavaScript if possible? Thank you! ...

increase number when I press arrow key on keyboard with javascript

Hi, I have a textbox has a numeric value. now what I want is to keep increasing that numeric value while im pressing and holding any of arrow keys. I know how to do this if I was pressing only one time. it will be increased by 1 only. but what If I want to keep increasing the value while i'm holding the arrow keys. how to do that? tha...

JS String.replace can be tempremental with Safari

The Backstory: This works fine in all browsers EXCEPT Safair (5.0.1) var chunk = arr[i]; chunk = chunk.replace('$', '\\$'); var a = eval('message.match(/' + chunk + '/gi);'); if(a instanceof Array) symbol = symbol.concat(a); So I modified it to the following: var chunk = String(arr[i]); chunk = chunk.replace('$', '\\$'); var a = eva...

BMP decoding in JavaScript and drawing to Explorer Canvas

I need to download a BMP with JavaScript and render it to the screen, in Internet Explorer. First off, yes, I know this is insane, I'm not going to get into why, let's just accept for a moment that img src is not working because of security constraints, but an ajax request with the proper authentication in the post will pull back the im...

JS/Ajax - Change page with PHP in ajax

Ive got an ajax type script changing div content with data from a PHP file using xmlhttp: function updatelog() { request = 'messages.php?new='+first+'&time='+lastupdate+'&user='+user; xmlhttp.open("GET", request ,false); xmlhttp.send(); document.getElementById("messages").innerHTML=document.getElementById("messages").innerHTML+xmlhttp.r...

Node.js return result of file

I'd like to make a node.js function that, when calls, reads a file, and returns the contents. I'm having difficulty doing this because 'fs' is evented. Thus, my function has to look like this: function render_this() { fs.readFile('sourcefile', 'binary', function(e, content) { if(e) throw e; // I have the content here...

How can I defer loading UpdatePanel content until after the page renders?

Old hand at ASP.NET, new to the UpdatePanel. I have a reporting page which executes a fairly length SQL query... takes about 10 seconds right now. What I would like to do is have my page fully render, with some placeholder text (Loading...) and then have the UpdatePanel kick off the actual time-consuming reporting process and render th...

Trigger inline onchange javascript.

I'm writing a greasemonkey script that creates an auto-complete search type box which makes it easier to select from a large dropdown on a webpage. The dropdown has inline onchange code which I can't seem to get to trigger when I change the selection using javascript. Any ideas? ...

How to fade in a div on hover?

I want to hover on an image, and have a div with text in it to fade in. Simple. Sidenote: I want it to be style-able by CSS. (Kind of a given.) Also, I tried using some examples but I am in a hurry so please and thankyou. ...

Slide down div on hover

I have a status bar at the top of a web page, and on hover OF A CERTAIN ICON ON THE STATUS BAR, I need a div to slide down from the icon to reveal a text box with a description. ...

Easiest way to give Javascript alert after PHP header() redirect

I have a page where users submit a form, and it goes to a separate PHP script. After the script is done, it header() redirects the user back to the page they were on. Now what I want to do is if there is an error or certain conditions in the script, redirect the user to the same page but display a Javascript alert once they get there as ...

Combining two images on one canvas in HTML5

I'm working with the HTML5 canvas element. Let's say I have 2 ImageData objects that I want to combine to be able to put on one canvas. Lets assume that I don't care how these images combine. Both ImageData objects have the exact same pixel count and shape. What's the best way to combine the two images? I figure that I can write a for ...

Is this a browser cache problem?

Hi, Can you check if this is a browser cache problem? I have this scenario, I have a table that displays data like this and below that is a link that sends you to another url. Only one row can be click at a time. <table> <thead> . . </thead> <tbody> <tr> <td><input type=""checkbox" val...

regex: read character behind number

i have regex code: <script type="text/javascript"> var str = "kw-xr55und"; var patt1 = /[T|EE|EJU].*D/i; document.write(str.match(patt1)); </script> it can read: str= "KD-R55UND" -> as UND but if i type: str= "kw-tc800h2und -> result tc-800h2und. //it makes script read T in front of 800 i want the result as UND ...