javascript

How might I extract the number from a number + unit of measure string using JavaScript?

If I have this string str = "22px"; How do I extract just the number 22? Thanks. ...

add custom function to YUI tabview

I've come up with the following function to fill a need: function getTabFromElementID(elementID){ //get all of the tabs from the tabViewObject var tabArray = this.get('tabs'); var foundTabObject = nil; tabArray.each(function(tabObject, index){ if(tabObject.get('element').id == elementID){ foundTabObject = tabObject ...

IE6 Strict Mode & Top:0, Bottom:0

I am building an extensible window control in JavaScript and intend to use two boxes as follows: <div id="outer"> <div id="inner"> content goes here... </div> </div> The CSS for this would be as follows: #outer { position: absolute; top: 20px; left: 20px; height: 200px; width: 200px; } #inner { ...

How to ignore mouse activity until function completes

I use the following code to slide out a div on a mouse-over, wait a couple of seconds and slide the div back. $(document).ready(function() {$("#divider").mouseover(function () {$("#slider").show("slide", {direction: "left"}, 1000).pause(2000).hide("slide", {direction: "left"}, 1000);} );} ); I'm sure this is simple, bu...

php in javascript?

i need to have some php code inside javascript <script ...> <?php echo " ... "; ?> </script> but this doesnt work. how can u implement php inside javascript that is in a own file javascript.php? ...

IE6: get value of a DOM select element

So I'm having a crossbrowser javascript issue. I've got a <select> dom element that has some descendent <option> element with selected=true. In Firefox, I can just do select_elt.value to get the value of the selected option, but this seems not to work in IE6 (which I need to support). I tried to iterate through the select_elt.getEleme...

Should setting `checkbox.checked = false` not clear the HTML attribute too?

Here's my HTML: <input id="test" type="checkbox" checked=""> Here's a Firebug excerpt: >>> test <input id="test" type="checkbox" checked=""> >>> test.checked = false false >>> test <input id="test" type="checkbox" checked=""> Um...am I missing something, or should that last line not read the following? <input id="test" type="che...

Javascript based drawing library for free hand drawing?

hello, I've seen there's a lot of libraries that will allow me to output shapes and lines but do these libraries allow for freehand drawing using the mouse? I want to allow users to draw and then to save their work to database. Is this possible? Thanks in advance! ...

How to get the "value" of a <select> in dojo?

I am using dijit.form.FilteringSelect to provide a way to select values from a . The problem is, when using dojo, the label is returned instead of the value of the s. For example: <select name="test" dojoType="dijit.form.FilteringSelect"> <option value="1">One</option> <option value="2">Two</option> </select> Dojo is returning the lit...

Setting Flash (AS3) variable with Javascript

How could I set a Flash (Actionscript 3) variable using javascript? Or is it possible to call a flash function with parameters from javascript? I have tried document.getElementById('flash').SetVariable("data", "asdf");but it only works in AS2 and AS1. ...

How to make document.body.onmousedown = ContextMouseDown; work in the other browsers?

Hi, The lines below work in IE, what do I have to do so that it works in the other browsers? document.body.onmousedown = ContextMouseDown; document.body.oncontextmenu = ContextShow; Thanks, R. ...

Is there an open source WebSockets (JavaScript) XMPP library?

Has anyone written an open source XMPP library that uses WebSockets and is meant to be run by a browser? ...

Turkish case conversion in JavaScript

I want to convert strings to lower or upper case in JavaScript in the locale I wanted. I think standard functions like toUpperCase() and toLocaleUpperCase() do not satisfy this need. toLocale functions do not behave as they should. For example in Safari 4, Chrome 4 Beta, Firefox 3.5.x on my system it converts strings with Turkish charact...

Is anyone doing visual debugging with Jint?

I've been using Jint to run server-side JavaScript code and I'm liking it a lot so far. The one issue I'm having is debugging. JInt exposes events that can fire when a statement is executed or a breakpoint is hit. As mentioned on the Web site, it would be possible to create a visual debugger that works through this mechanism. Before ...

lowpro x non-ajax post in a rails application

Hi, i have a form, that because it has a upload file, i had to switch from ajax to iframe post to emulate an ajax. The problem is that it has a component with lowpro to hide and show a button with onmouseover and onmouseout. Everything work fine. The problem is that after that i submit the form, with iframe, after the page reload, the ...

How could I modify this template to add butons that would scroll to the next section?

I am trying to make a horizontally scrolling Web Page. This template uses J Query and CSS to control width, but the User still has to drag the scroll bar across the bottom - how would I add arrows or something that the User could just click on and it would go over to the next section? Thanks in advance for your help! http://css-tricks.c...

Javascript top variable in IE8

I am trying to reference a javascript function in a .js file loaded in my main page from an iframe using the 'top' variable. It works in FF, Safari, and IE6 but not in IE8. The snippet is (assigned to onmouseover): top.set_image(this, 'images/login_h.png') Where set_image is my function. The error is "Object does not support t...

What is the best HTML, CSS and JS reference you know, respectively?

Possible Duplicates: Best reference sites for HTML and JavaScript programming What is the best online javascript/css/html/xhtml/dom reference? What english-language online resources do you use as a reference on HTML rules, tags and elements, and real-life compatibility information (IE 6 on Mac renders tag X only if the doctype...

Automatically initialize rich text editor on top of all textarea's, including ones that are loaded via ajax

I'm developing an ajax heavy web app, and would like to have textarea's (with class="ui-richtext") automatically initialize TinyMCE. This is easy for textarea's that are loaded normally, but how about for content that is loaded AFTER the fact using ajax? I was thinking something along these lines: (i'm using jquery) $("textarea.ui-ric...

time convert in javascript

How does one convert the following to seconds in JavaScript? mm:ss.sss ? What is the .sss? ...