javascript

How do I rotate a single object on an html 5 canvas?

I'm trying to figure out how to rotate a single object on an html 5 canvas. For example: http://screencast.com/t/NTQ5M2E3Mzct - I want each one of those cards to be rotated at a different degree. So far, all I've seen are articles and examples that demonstrate ways to rotate the entire canvas. Right now, I'm guessing I'll have to rota...

Replace number in a string using regex or something else

Hi, I am not so good with regex. I am struggling to find a solution for a small functionality. I have a ajax response which returns a string like "Your ticket has been successfully logged. Please follow the link to view details 123432." All I have to do is replace that number 123432 with <a href="blablabla.com?ticket=123432"> using ja...

JavaScript/jQuery: Animate li movement within a list?

I've got some code that's basically identical to the jQuery UI Sortable example here: http://jqueryui.com/demos/sortable/#default This allows users to re-order LI elements within a UL. I've now run into a situation, though, where I want to animate the LIs changing position... basically as if the user had dragged them herself. This is p...

Javascript DOM failing when moving a CKEditor node

I need to be able to swap CKEditor rich text areas throughout my webpage. My current script works great when there's no CKEditor applied, but does not successfully move the text area (and entered text) when CKEditor is applied. Here's some code(it needs ckeditor to work): <html> <head> <title>Sample - CKEditor</title> <script ...

jQuery .height() property not working

I'm attempting to get the height of an element using jQuery, but am receiving some unexpected results. Here's the code: $(function() { var contentheight = $('#subpage-content-small').height; alert(contentheight); }); Where #subpage-content-small has these CSS properties: #subpage-content-small { width: 400px; float: left; m...

How to generate graphics into photoshop using actionscript?

I've a text file with content like this: id, pixelsize, color, text block1, 200x60, black, Header block2, 200x180, white, Body block2, 200x60, black, Footer Now using actionscript, I want to generate a psd file which would generate a 3 vertical block graphics (like this) after parsing the given file. All the blocks are placed verti...

Clearing a form field when page goes back (html / javascript)

Do you know when you use in a form the password field, like this: <input type="password" name="pass"> And you do a GET or POST submit to the same page who have the form and if the user hit back in the browser the password field gets blank. Well thats good, but i need to get blank another form field when the user hit back. Thats because...

Clickable label not working in IE 8

I've got the following list item: <li> <input value="someRadioButton" name="ctl00$mainContent$group" type="radio" id="ctl00_mainContent_somelRadioButton" onclick="showSomeInfo()" /> <label for="ctl00_mainContent_someRadioButton"> <img class="extraPadding-Right-10" src="https://xxy.com/some_mark_37x23.gif" /> ...

How to add and remove nested model fields dynamically using Haml and Formtastic

We've all seen the brilliant complex forms railscast where Ryan Bates explains how to dynamically add or remove nested objects within the parent object form using Javascript. Has anyone got any ideas about how these methods need to be modified so as to work with Haml Formtastic? To add some context here's a simplified version of the p...

Javascript opens new window and loads _self

This code loads the href into a new window and into self, why is this? Shouldn't return false; stop the default click? //get links in paragraphs var first_p = $$('#client_work p a'); //get first link var client_link = first_p[0]; if(client_link) { $(client_link).observe('click', function() { var mylink = window.open(clien...

Pass a value from Parent to Child (Open) window

How to pass value from parent to child window field. I use window.open("www.google.com"); after popwindow is opened i need to pass/set search value typed in parent window to child window(www.google.com) ...

Javascript onclick event is not working in internet explorer 8.

Hi, I have the following line of code that works fine in Firefox, Chrome and Safari, but not in internet explorer 8. <a href="javascript:void(0);" onclick="showHide('reading','type_r','r');">Show me the example</a> The function simply shows and hides a div on clicking the hyperlink. Is there anything I'm missing here? This is the sh...

How to getting browser current locale preference using javascript?

Does anyone know how to obtain the browser culture from firefox and google chrome using javascript? Note: This is an asp.net 3.5 web application. The requirement is to try and set the applications display culture based on the browser culture. I have found very few bits and pieces of information for the other browsers but they do not ...

How to make an HTML/JS WYSIWYG editor?

I've tried many different Google searches but I haven't been able to find a current tutorial (newer than 2006) on how to actually create a WYSIWYG editor. I realize there are many already, but I'm curious as to how they actually work. I've looked over some of the source code, but it's a lot to digest. I was wonderring if someone could de...

How can i have a div stuck on the left side of the page no matter how much i scroll horizontally?

This is kind of difficult to explain so ill link to a page that has the effect i need; http://wpaoli.building58.com/wp-content/uploads/2009/08/feedback-panel.html The feedback thing on the left side is what im trying to implement on my side, instead of feedback im going to use it as a navigation menu that shows up when clicked on. the...

Find and list all functions/methods in a set of JavaScript files

Is there a way to read a set of JavaScript files, and output a description of where every function/method is defined? I realize that this is likely impossible in full generality, due to the extreme dynamic nature of the language. What I'm imagining is something which gets the (relatively) straightforward cases. Ideally, I'd want it fig...

How to retrieve an input's value without the browser interpreting html special entities?

Is there a way in JavaScript or MooTools to retrieve the actual text in the value from an input element without the browser interpreting any html special entites? Please see the example included below. My desired outcome is: <div id="output"> <p>Your text is: <b>[&lt;script&gt;alert('scrubbed');&lt;/script&gt;]</b></p> </div> Not...

How can you replace a link's target in Greasemonkey?

I'm trying to write a script in Greasemonkey that will replace a link's target with something else, but with my limited Javascript knowledge I don't really know how to do this. Basically I'm trying to find all links containing a certain string of characters (ex: //a[contains(@href, 'xx')] ), and either replace them with another link, o...

Why Ruby on Rails uses default Prototype?

I just recently started learning RoR. In Rails by default available Prototype. Why uses it is this library? Why is not jQuery, Dojo, Mootools, ExtJS ... ...

jQuery select change/click problem - change doesn't work in IE, click doesn't work in Chrome

As the title says, I have a problem with binding to a change in a dropdown select list - it seems that "change" doesn't work with IE(7 or 8), so when I try the alternative and use a "click" event, it works in IE but doesn't work in Chrome! Am I missing something obvious here? Here's my code: //event handler for showing hidden form elem...