javascript

What questions should a JavaScript programmer be able to answer?

Suppose a company is going to hire JavaScript coders. I wonder what question should this company use to properly evaluate them. Even though general programming skills are more important than technology-specifics, they need to be tested on what they are going to work with. How would you do that? How would you test if they have the proper...

How can I reuse objects in JavaScript?

I'm not new to JavaScript, but I've never really had too much in-depth knowledge of how it works. I'm currently developing some software for a cell phone that is done completely in JavaScript. Everything runs fine, except that once in a while the garbage collector kicks in, and everything stops momentarily. The problem is that objects a...

What are the best/more stable features of the Google Closure Library

In November 2009 Google announced the release of Closure Tools which include the Closure Library. According to this post google closure library contains some battle-hardened parts and others more experimental. Could folks with experience using google closure share info on which parts are solid and which are iffy(er) or not ready for pr...

Mootools Delay Issue

I'm ultimately trying to delay the fade out by 5 seconds (page loads, 5 seconds later the fade out happens). But right now the bit of code below throwing a "delay is not a function" error. el.fade('out').get('tween').chain(function(){ el.destroy(); }).delay(5000); ...

submit form with link while checking values

I have an HTML form defined as <form name="writeYourAd" id="writeYourAd" method="post" action="post.php?action=preview" onsubmit="return checkContentForm(this);" enctype="multipart/form-data"> If I use a , it works fine. But if instead I use this: <a href="#" class="mmh_orngebtn mmh_grybtn" onclick="javascript:document.writeYourAd.su...

refactor to use oop mvc

how do I refactor this to use oop , with mvc pattern. (function () { var dataToImage = { 'a': 'a.gif', 'b': 'something.gif' }; var currentimage = dataToImage['a']; function setCurrentImage(e){ currentImage = e.src; } function getMousePosition(){ } function drawToolbar { for(i in dataToImage){ document.write('<img sr...

Need to set 1 span's style to display:block on page load for an image gallery made up of span's set to display:none

i have some javascript in the head of a page that controls an image gallery where the user clicks a thumbnail image and a larger image and some text are revealed in a span. there are 10 of these thumbnails per page and i need to find out how to set the 1st thumbnail's hidden span to "block" on page load. <script type="text/javascript"...

Responding to the onmousemove event outside of the browser window in IE

In Internet Explorer 7 body onmousemove or document.onmousemove events only seem to fire while the mouse is inside the browser window, not when it's outside. Yet in Firefox the onmousemove event is called correctly when I move outside of the browser window. How can I setup an event to be called outside of the browser window in IE? Goog...

Array to store in Cookie (JS)

On a site I'm coding, there's a Partners page that contains, amongst other things, a phone number for that business to view. My boss wants this phone number to be hidden then, upon being clicked, appear (I'll fade it in with jQuery) and then log the click. This will allow him to keep track of the amount of people that have shown interes...

Check DIV position relative to browser screen - jQuery

I have many DIV with the same class name, let save "wmplayer". I want to make sure that when these DIV get close to bottom of browser, let say 100px above the bottom, they will have display:none. How do I do that with jQuery? Thanks ...

javascript jsgantt to PDF

Hi, i am using jsGantt javascript library for showing gantt charts in html . now i want to save that generated ganttchart in PDF form how i will use that ?? the problem is with CSS , and JavaScript.... thank you , ...

How to mock .each and .find method in jQuery using Jack?

Hi all: I'm currently trying to mock the following method using Jack. The code example is as below: var ID = "id"; $('#' + ID + ' > div > table').each(function) { var nodeSpan = $(this).find('span.' + NODE_INDICATORS)[0]; . . . }); How should I approach it? Are there jQuery/QUnit functions that allows me to create a DOM node/el...

How to avoid scientific notation for large numbers in javascript?

Javascript converts a large INT to scientific notation when the number becomes large. How can I prevent this from happening? Thanks! ...

Load javascript via jQuery ajax

is it possible to use jQuery %Json function to load a javascriptfile.js asynchronously? ...

javascript for searching Text in PDF File Open in Browser Window

Hello, can u help me in giving code for "javascript for searching Text in PDF File Open in Browser Window". ...

How to add a style to <iframe> tag using javascript when it's parent tag's id is known?

How to apply a style to an iframe whose parent tag's id is known?? Example: <div id="xyz"> <iframe ....> </iframe> </div> I want to apply style to iframe as height: 70px. I just got to know how to do this using CSS. How can I do that using javascript. Any help very much appreciated! ...

problem with images load on setTimeout

Hello everybody, I have a problem, that i seems not be able find my way around it. The problem is, that I load images and some text trough ajax call, and then after some time i try to call ajax function again to get new set of images and text. However my problem is that images don't load in time (everything is fine with the text load) ...

Opera colors strangeness

I jave a Javascript code that draws a shape with specific color using "style.backgroundColor=". It works fine with one exception - for some reason Opera decides to set the color to similar, but not exactly the same one as the one that I want. For instance, if I set the color to #324252 Opera decides that it should be #314152! All other b...

convert HTML ( having Javascript ) to PDF using java / javascript

Hi, i want to convert HTML (having javascript ) to PDF.. how i can do that ?? i just want to show what is being shown in web page ... like my scenerio is . i am displaying a gantt chart that is generated by javascript library .. now i want to save that HTML web page in PDF ... how to do that ???? ...

JS functions not working while loading html using Ajax

When I load an asp file (Main_Page_1.asp), in the click event of a button there is a function invocation is not working. There is I am stuck in. for eg:- Main_Page_1.asp <head><script type="text/javascript" src="JsFile.js"></script> <script type="text/javascript"> function buttonClicked () { var xmlHttp; try { xmlHttp=new X...