javascript

How to use javas built-in javascript engine to run script on a web-page?

Hi, I want to show lyrics for songs in my player. I used to use lyricsplugin.com because it had a lot of English and Russian lyrics, but recently they've changed their web-site from being a static page to an ajax-powered page. Searching lyrics follows this pattern: http://www.lyricsplugin.com/winamp03/plugin/?artist=Linkin%20Park&ti...

Disable onmouseover/onmouseout on iPad

Hello developers, Is there any was how to disable mouseover/out events on the iPad? My problem is that we are using mouseover/out events to display some tooltips on the web and onclick event to display detail. Unfortunately this means that on the iPad you have to tap twice. Is there any global option or something like that? Thanks in...

Chaining asynchronous methods in JavaScript

Hello, I'd like to do something like this: var res = myAjax.post(); myAjax is basically my own ajax wrapper (asynchroneous). I don't necessary need the chaining, but i'd like to be able to do the call like shown above. I'd like a callback to be handled by the object itself. I've read about asynchroneous method queues, but, honestly, ...

Position of Google Javascript on a page

Hi, I just fixed a spacing bug on a HTML page I have inherited - and I worked out in the end that on that particular page this being at the top of the page was pushing the layout out; <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js"&gt; </script> I understand that it's good sometimes to place j...

A question about eval() in javascript... why is it evil and how can I accomplish the same thing without using it?

I have an application script that is working correctly, but I have a few eval() statements in order to make things work. I don't really understand why "eval is evil", as I keep reading, but what I really don't understand is how to avoid using it when it's the only thing that does what I need it to do. In my script, I have a bunch of pro...

Removing an image from a canvas in HTML5

Hi, there's an example, which loads 2 images: canvas = document.getElementById("canvas"); ctx = canvas.getContext("2d"); var img1 = new Image(); img.src = "/path/to/image/img1.png"; img.onload = function() { ctx.drawImage(img, 0, 0); }; var img2 = new Image(); img2.src = "/path/to/image/img2.png";...

In Javascript, what does this syntax mean?

I found this snippet when i was looking at jQuery plugins and wonder what it actually does A jQuery plugin skeleton: (function($) { ... })(jQuery); And more recently in nettuts: var STICKIES = (function () { ... }()); ...

JavaScript: Passing parameters to a callback function

Hi, I'm trying to pass some parameter to a function used as callback, how can I do that? function tryMe (param1, param2) { alert (param1 + " and " + param2); } function callbackTester (callback, param1, param2) { callback (param1, param2); } callbackTester (tryMe, "hello", "goodbye"); ...

jquery click event on <tr> elements with in a table and getting <td> element values

I have the following HTML in a JSP file: <div class="custList"> <table class="dataGrid"> <c:forEach var="cust" items="${custList}"> <tr> <td>${cust.number}</td> <td>${cust.description}</td> <td>${cust.type}</td> <td>${cust.status}</td> </tr> </c:forEach> </...

How do you go about refactoring the front-end of a large website?

I have a very large website that I need to refactor the front-end of due to maintainabilty concerns and performance issues: Whats tricky: Lots of overcomplicated scripts Over-complicated CSS with a whopping filesize No selenium tests in place No js tests in place Back end developers concerned anything breaking The site has been live f...

jQuery fadein fadeout text

Hello, I have this at the moment: (the list is longer, but this is just one element) <a href="Products.aspx" onmouseover="onMouseOverCatDisplay(&quot;H5032.jpg&quot;, &quot;Go to: cars&quot;);" onmouseout="onMouseOverCatDisplay(&quot;DSC_0414_SS.jpg&quot;, &quot;You see: bike&quot;);">Car</a> and above the html, I have ...

ASP.NET Javascript DateTime TimeZone Issues

Hi All, I am having an issues passing a JSON containing DateTime to asp.net code-behind (c#). If the client browser is in the same timezone as the server I have no issue, but if they are in different timezones my time is getting modified by the offset value of the two timezones. But all my datetimes need to be the date with a time of ...

ERROR:Couldn't find form element in any form int the page! Init aborted

Hi. I have a page written in python and I also have dynamic drop down lists (select form fields). When I run it I get the error: ERROR:Couldn't find form element in any form DEPT the page! Init aborted Anyone know what this means? Should I have the name of my form be DEPT? ...

midlet application

I have to generate random number between 1 to 10 and compare the highers number and lower numbers. if the random number is high then display on the screen otherwise goto wrong screen shown text box, score, if the random number is low compare to lower num then display on the lower screen.here we have to increment score with 5 for every co...

Is there a way to port a chrome extension to other browsers?

Is there a way to port a chrome extension to other browsers, without having to entirely re-write the code? My chrome extension uses the browser_action command to open "popup.html" in the extension window... Update: I found this and found it only somewhat helpful for porting... ...

innerHtml and innerText destroys tabs in Internet Explorer

I want to take the content of a textarea and put it in a <pre>. Problem is that if i set the innerHTML-property of the pre to the value of the textarea all tabs and linebreaks will be removed in Internet Explorer. If i use innerText instead of innerHtml i will get the line-breaks but tabs still disappear. Works fine in other browsers. I...

Why I am seeing static method warnings from Eclipse with dojo.*() ?

I'm writing a Dojo class that looks something like: dojo.provide("my.class.name"); dojo.declare("my.class.name", null, { myFunction: function(param) { // ... dojo.aValidDojoFunctionSuchAsrawXhrPost(param) { // ... } // ... } } I'm using Eclipse (in fact Rational Application Develope...

Play swf file once on mouseover using javascript

Hi Folks i need to play a .swf flash file when i mouse over one of my links so <a href="123.html" onMouseOver=" PLAY MY SWF ONCE ">123</a> can you please help me achieve this using javascript Thanks ...

How to add Rich Text Editor to display code snippets

Im working on a Rails based application where I have the need to allow the user to format the text he enters and I would also like a way to highlight code snippets the way Stackoverflow does when I enter a code snippet. Are there any plugins that do this. And I would also like to know which is the RTE that is recommended and would be ...

onFocus error in IE

Why do I get an error in IE for this line of code: I used some stuff that works on the iPad but I was getting an error for the onFocus stuff before I even added it... here is the script that runs on focus: function enterValue () { document.form1.itemQuantity.value = ""; } any idea's...