javascript

problem with inserting HTML with insertHTML

Hi, I'm trying to make wysiwyg editor with content editable divs and I'm inserting html with document.execCommand('insertHTML', false, html); but the problem is, when i insert link, and then i want to write after it continues to write INSIDE that link. EXAMPLE: how it does now: Hello, <a>stackoverflow.com MyTextAfterLink</a> how it ...

Refactor link to show/hide a table row

I have a table with row which cab be hidden by user. It's implemented this way: Markup: <table> <tr> <td> <table style="margin-left: auto; text-align: right;"> <tr> <td class="stats-hide"> <a href="#" onclick="hideStats();">Hide</a> </td> <td c...

JavaScript 'contenteditable' -- Getting/Setting Caret Position

I have read a few posts on positioning the caret, but none seem to answer my particular issue. I have 2 divs (div1 and div2) div1 = noneditable div div2 = contenteditable div both divs contain exact same contents when user clicks on div1, it gets hidden, and div2 appears in exact location and user can edit The problem: I want the car...

Javascript: find array by name

Hi, I have some js arrays and I want to find the arrays by name. for example: arr1 = [1,2,3]; arr2 = [3,4,5]; And access them like this: var intNum = 2; var arrName = 'arr' + intNum; arrName[0]; // equals 3 Is this possible? Thanks, Kevin ...

Google Contacts Data API and PHP

I'm developing a PHP application to retrieve the list of contacts from a GMail account. I'm looking for a solution which would enable the user of my application to provide the login and password to their Gmail account in my application (as opposed to getting redirected to Google) and then automatically do the retrieval. The retrieval pro...

Get notified when objective-c dom updates are ready initiated from webview

I am programmatically updating the DOM on a WebKit webview via DOMElement objects - for complex UI, there is usually a javascript component to any element that I add. This begs the need to be notified when the updates complete -- is there any such event? I know regular divs dont fire an onload or onready event, correct? The other assumpt...

Code Highlight with javascript ?

Is there any API or a jQuery plugin that allow me to highlight a code on my website? For example <pre code="c#"> var x = new StringBuilder(); var complex = new Complex(); </pre> <script type="text/javascript"> $("pre[code]").codehighlight({ language: "c#" }); </script> Something like that? ...

Using JavaScript codes which is in the textarea.

I want to create a <textarea>. And I want to use JavaScript codes which is in the <textarea> as codes. How can I do it? ...

opening a different webpage from my webpage and reading its content /clicking buttons etc

Hi friends, i was just curious as how to do this. i want to open www.whatsmyip.com or something similar from my webpage. put an ip address in the textbox in that page. click the button and read the value(suppose a textbox).. i want to achieve all this programtically without any humaninteraction.. how is that possible. ...

How do you make an image opened in colorbox scrollable

I would like my images that I open in colorbox to be displayed fullsize with no resizing applied to them and then apply scrollbars to allow for viewing the larger images. Some of my images are quite tall and things get pixelated when resized down. Currently colorbox just resizes my images down to the size of the available height/width....

Triggering a JavaScript click() event at specific coordinates

Trying to fire off (trigger) a click event. Its easy to do in jQuery, but cannot figure out how to set the coordinates of the event and send them along. Essentially, I need to trigger a click at a specific location (which is calculated prior to the trigger() call). Any way to do this (in jQuery or otherwise)? Thanks - ...

java script is not working in mozila

I have added some javascript in html page for input validation.same page is working correct in IE and chrome but in mozila its not working.The problem is when user inputs invalid data its supposed to show alert msg box and when user clicks OK it should return false to form...BUT mozila is not waiting for alert box it just shows alert box...

Style / Replace a select box using prototype / scriptactulous

Hey everyone, I'm trying to style my select box, I assume I need some type of javascript method. I'm using rails - and sticking with prototype/scriptactulous. Does anyone know of any solutions? EDIT: CSS doesn't do nearly what I'm trying to accomplish: ...

javascript to determine if page on remote domain has changed

Hi, I am trying to find a client-side way to determine if a page on a remote domain has changed. I can't load the page in an iframe and examine its contents due to same origin policy. So I tried using .getResponseHeader("Content-Length") and .getResponseHeader("Last-Modified") but apparently these are also restricted by SOP even tho...

HTML5 Canvas: How to fake globalCompositeOperation="darker"

I've googled and googled about this, and all I can find, including on StackOverflow, is "support was and is broken in most major browsers." Not an actual solution to my problem. This month's Playboy came with a pair of 3D glasses (red/cyan) to view the eye-popping centerfold. Naturally, I hit the Internets to find every single red/cya...

Import/Export HTML5 localStorage data

Hi all, I'm working on a simple TODO list app based on localStorage HTML5 feature: http://hamen.github.com/webnotes/ I'm wondering if it's possible to import/export data in some way. How could I provide an "Export note/Import note" feature to make users being able to save their note on their HD and import them in another browser profil...

How to store <TR> id value in array, when I toggle?

I am toggling 'tr.subCategory1'and its siblings .RegText. at the same time I am trying to store its ids in the array like this list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null; (When I collapsed I need store 'null' in array at its id place, If I expand I need store I need store 1 at its id place). But ev...

Select All in Javascript (Firefox extension) not working right

I'm having some problems with a select all/ none function. (I didn't write it, I'm trying to fix it!) It currently looks like this: rsfindmod.SelAll = function(){ document.getElementById("ListBox").selectAll(); document.getElementById("ListBox").focus(); } It's being used on a dynamically generated set of links, so there's no ...

Is there a way to use the drawWindow() method on a live website?

I don't think the drawWindow() method works on a live website. Is there a way round it? ...

Is there any better way for creating a dynamic HTML table without using any javascript library like Jquery YUI etc

Dont worry we dont need to find out any bug in this code.. Its working perfectly.:-P My boss came to me and said "Hey just tell me whats the best of way of writing code for a dynamic HTML table (add row, delete row, update row).No need to add any CSS. Just javascript. No Jquery library etc. I was confused that in the middle of the proje...