javascript

obj is null, javascript

function init() { alert("init()"); /** * Adds an event listener to onclick event on the start button. */ xbEvent.addEventListener(document.getElementById("viewInvitation"), "click", function() { new Ajax().sendRequest("31260xml/invitations.xml", null, new PageMaster()); xbEvent.addEventListener(docume...

How can the selection of a textarea be determined/manipulated in Safari from JavaScript?

I have some JavaScript code that does two things: retrieves the selected text from a text area adds a prefix and suffix to that selected text The code currently uses the selectionStart and selectionEnd properties of the textarea to figure out where the selection starts/end, extracts the selection text and processes it, and then re-wr...

How to Queue JS with Rails Helpers

Hey. Say I want to queue these JS calls, can that be done with the Rails helpers? render :update do |page| page.replace_html replace_html 'notice', flash[:notice] page.visual_effect :blind_down, "notice", :duration => 0.5 page.visual_effect :blind_up, "notice", :duration => 0.5 end Thanks. ...

Split a html code in two equal content parts, in PHP or JS

I want to take the content of a website article and create two or more columns of text. The difficult part is that i must keep the html tags and also close them if the cutting is done inside a <p></p> for example. Example: <p><span>One two three <strong>four</strong></span> five six</p> Result: <p><span>One two three<span><p> <p><s...

YUI Calendar: How to disable the nextMonth click

Hi, In the YUI Calendar header there are left/right arrows (links) that changes the current month. I'd like to be able to disable the click event of this links. I tried using changePageEvent() but it happens after the month have changed. YAHOO.util.Event.removeListener didn't seem to work (maybe I'm doing it wrong). thanks ...

Use canvas tag or create a bunch of <div's> Whats faster?

Hey I have an array of hexadecimal colors and for each color in the array I want to create a 80px by 80px square representing that color. What would be faster performance wise? 1: Use the canvas tag iterating over the array and using the fillStyle and fillRect(); or 2: Iterating over the array and creating a div box and setting the ...

Using JQuery how to show and hide different div's onClick event

I would like to show a div based on the Onclick event of an link. First Click - Show div1 Second Click - Hide remaining div's and Show div2 Third Click - Hide remaining div's and show div3 Fourth Click - Hide remaining div's and show div1 => repeat the loop and goes on.. Code Follows: <div class="toggle_button"> <a href...

Dynamic web pages (Javascript) - monitoring contents from outside

Let's assume I browse a specific web page that uses JavaScript to update its view constantly (using Web 2.0 techniques to talk to their server to retrieve updates of data). Now I like to run some code on my own computer that monitors the contents and alerts me if some specific data appears on the page, so that I could record that data, ...

JavaScript NodeList

Hello All, is there a way to join 2 NodeLists returned by 2 calls of document.getElementsByTagName? Say, I have the following code var inputs = documentElement.getElementsByTagName('input'); var selects = document.getElementsByTagName('select'); I want to loop through the results. Is it possible in one loop? Thank you in advance! ...

Show and hide divs at a specific time interval using jQuery

I would like to show divs at a specific interval (10 seconds) and show next div and as go on and repeat the same. ** Sequence : ** On 10th second show div1 , hide other divs , After 5seconds interval Show div 2 and hide other divs, After 5 seconds interval Show div 3 and hide other divs, and repeat the same for every 10 secon...

Inspect the names/values of arguments in the definition/execution of a JavaScript function

I'm looking to do the equivalent of Python's inspect.getargspec() in Javascript. I do know that you can get the arguments list from a Javascript function, but what I'm really looking for is the names of the arguments from the originally defined function. If this is in fact impossible, I'm going to have to 'brute-force' it by getting th...

Web based word processor

Do you know of any free JavaScript framework that knows how to read and write doc, docx and odf documents like Google Docs? I want do download it and include it in my own web based application. If there is no such framework, what are my alternative? ...

Registering extension EJS with visual studio and intellisense?

Hi there, does anyone know how i can map EJS to visual studio to act like a HTML file. I think i managed to do it but its got a lot of bloat in it.. Its basically an HTML file without the HTML and BODY tags.. so i selected the UserControl in VS 2008, tools, options, Text Editor, file extension and added EJS and added it as usercontrol. ...

Javascript: Validating dynamically created radio button list control in ASP.NET

I have an ASPX page where in the page load i am dynamically creating some radio button list controls and rendering to browser.I will have 2 list items in each radio button list .One is Yes and second is No. The number of Radio buttonlist can be n.Now in my java script code, i want to know which radio button is clicked . I m already using...

How to match with javascript and regex?

I have the following HTML: <span id="UnitCost5">$3,079.95 to $3,479.95</span> And i want to use Javascript and Regex to get all number matches. So i want my script function to return: 3,079.95 AND 3,479.95 Note the text may be different so i need the solution as generic as posible, may be it will be like this: <span id="UnitCost5">...

js seems not to be able to find my form

<div class="poll"> <h1>Poll</h1> <form name="pollvoteform1" method="post" xxaction="/plugins/content_types/poll/poll.php"> <p class="tekstaanmelden"><b>Het regent </b></p> <input type="hidden" name="poll" value="1"> <input type="hidden" name="cmd" value=""> <div class="pollOption"><input type="radio" class="stel...

advantage of $.each method over for..in loops?

Various JavaScript libraries (e.g. jQuery) offer an each method: $.each(myObj, myFunc); What's the advantage over using the built-in for..in loop: for(var i in myObj) { myFunc(i, myObj[i]); } In both cases I'd have to check for unwanted properties (usually functions), so I don't see why the each method is provided in the first ...

Passing an array to Javascript in COMET

I got a basic gist of what COMET does (the constant looping on server side, and printing out <script> tags way), so I am just fiddling with it. I can pass a simple string from PHP to Javascript that way, but what about PHP arrays? Is there anyway to pass a PHP array to Javascript (casting it to a JS array??) using this method?? ...

Javascript best practice: handling Firebug-specific code

Firebug is certainly a wonderful tool for javascript debugging; I use console.log() extensively. I wanted to know if I can leave the Firebug-specific code in production. What's the best practice? Commenting the debug code? ...

Loading a 32-bit process in a 64-bit environment.

I have a couple of questions as below. CHM is (Compiled HTML File) My CHM file has a link to launch a 32-bit application. The CHM file is coded in Javascript.This works fine in a 32-bit OS environment. But this does not work in a 64 bit OS environment.The reason being: When I open the chm file,64-bit version of hh.exe(an operatin...