javascript

help me improve my basic point to point move animation algorithm

Greetings, With javascript, I am trying to make a very easy animation, an image moves from one X and Y coordination to another X Y coordination. I have 4 constant such as: var startX = 0; //starting X of an image var startY = 0; //starting Y of an image var endX = 100; //ending X of an image var endY = 200; //ending Y of an image //the...

Flotr x-axis date/time

I'm using flotr in my app and I need some simple way to show dates on x-axis. I know flotr is able to display time on x-axis via 'xaxis' : {'mode' : 'time', 'min' => '??', 'max' => '??', 'timeFormat' => '??', 'noTicks' => 10} But how about dates? Anyhow, I can't get time x-axis working either, so any real example of time x-axis would ...

how to make div click-able?

<div><span>shanghai</span><span>male</span></div> For div like above,when mouse on,it should become cursor:pointer,and when clicked,fire a javascript function,how to do that job? EDIT: and how to change the background color of div when mouse is on? EDIT AGAIN:how to make the first span's width=120px?Seems not working in firefox ...

how to get a cookie value from javascript and set it by PHP?

I'm new to cookie operations ...

Display a temp image while page loading

I develop a webpage , in that I scrap the data from webpages, so it takes some time to load. But in that time a blank page will be shown in the background. I need to show an alternate image until the page is loaded. Help me to do this. thanks in advance ...

Best Practice to use JavaScript ?

Hi Folks, what is the best practice to include Javascript to your webapplications ? Think about the following situations : Different HTML Pages NO JavaScript Framework like JQuery or Dojo Different JS-Functions for different Pages. Iam not sure, but i think there are 3 Solutions ? Include the stuff directly in the html file Put t...

Why doesn't the following Javascript code (to set CSS style) work?

I'm trying to set the CSS style of an object with the following: document.getElementById(obj).style='font-weight:bold; color:#333;'; but it's not working. Does anyone have any idea why? ...

Regular Expression to validate a timestamp

Hi, I need a regular expression to validate a timestamp of the format, using Javascript: YYYY/MM/DD HH:MI:SS I tried cooking up a few, but seems my regex skills fail to cover something or other. Please give me a reference or way to do it. P.S. : I mention regex, only as a suggestion. Im using Javascript and welcome any alternati...

converting html+js to exe

I have an HTML file with embedded Javascript, and I want to convert it to a stand-alone exe. Is that possible? How can I do it? Any html2exe tool out there? P.S. If you must ask why, it's a very simple text-processing utility, but certain people want it (for reasons beyond me) as a desktop application. ...

Resizing of AS-based Flash app from FireFox vs. IE...

I have put in some controls to allow users to resize my Flash app via Javascript: document.getElementById("flashApp").height*=1.25; document.getElementById("flashApp").width*=1.25; This works great in IE/Safari, but is ignored in Firefox. I know it's talking the the flash app and gets and sets the height/width vars ok, but the same co...

how to get selected text inside a textarea element by javascript?

I'm not familiar with such attributes, can someone provide a simple demo? I need it to be done without any libraries. ...

iframe onmouseout capture

Hi, I currently have an iframe within my parent page and I was wondering whether it's possible to capture a onmouseout event to trap when the user clicks or moves outside the iframe border, i.e back onto parent page. Would really appreciate some help. Thanks. Tony. ...

giving javascript/the server time to process

Hello all, I've got a confusing problem. I'm working on a music catalog/playlist/player. When a user drags a song into the playlist a request is sent to php (via javascript/ajax) which finds the song in the database and returns song information which is then organized and displayed in the playlist. This works great. The problem I'm havin...

HTML blank I want to erase...

Hello everyone there! I have a new problem that bugs me ... I am making a web page that I want to be fixed with no scrolling and most important I want my main Div to fill aaaaaaaaall my available space... I made this code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&g...

Get Next and Previous Elements in JavaScript array...

I have a large array, with non-sequential IDs, that looks something like this: PhotoList[89725] = new Array(); PhotoList[89725]['ImageID'] = '89725'; PhotoList[89725]['ImageSize'] = '123'; PhotoList[89726] = new Array(); PhotoList[89726]['ImageID'] = '89726'; PhotoList[89726]['ImageSize'] = '234'; PhotoList[89727] = new Array(); PhotoLi...

How can I pass JavaScript errors from an action to my view?

I have 2 actions, one for GET and the other handles POST requests. Although I have validation on the client side, there are some things I check for on the server-side also (in my action method). In the POST action, when I find errors etc. that I want to report back to the UI, what options do I have to send back messages/errors to the c...

Add packaged javascript to page from ASP.NET server control?

Is it possible to create an ASP.NET server control that packages some javascript that will be emitted to the aspx page at design-time rather than run time? I am trying to create a control that will have "default" javascript. I can add jvascript using RegisterClientScriptBlock, but then a web developer can't modifiy the javascript - it is...

Is this right? A jQuery bug that erases the data store?!

Fire up your firebug console and try this out. Compare this: $('body').data('x',1); $(thisx).remove(); console.log($('body').data('x')); to this: $('body').data('x',1); $(this.x).remove(); console.log($('body').data('x')); Notice the difference? If thisx is undefined, it will immediatly throw a reference error. If x is an undefin...

How to detect if a variable is an array

What is the best de-facto standard cross-browser method to determine if a variable in JavaScript is an array or not? Searching the web there are a number of different suggestions, some good and quite a few invalid. For example, the following is a basic approach: function isArray(obj) { return (obj && obj.length); } However, note...

What is jQuery(document) vs. $(document)

I don't get what jQuery(document) is here. I thought you always used $(document) see here in his examples: http://sorgalla.com/projects/jcarousel/ ...