javascript

Recursion AJAX post, Causing Computer to run slowly

I have this recursion loop where inside the function I have atleast 2 ajax get/post, and the recursion happens after the first ajax get. my function structure is like this, function Loop() { $.get(url, data, function(result) { for loop to render the result { // render the result here } for loop to...

Chrome javascript pop up window has a wrong dimension

I'm trying to open up a new window for a chat room on our site. I have the chat room's dimension set to 750px x 590px. This is the link I have to open up the javascript pop up. <a href="javascript:void(0)" onclick="window.open('http://gamersunite.coolchaser.com/message/gu_chat','gu_chat','width=750,height=590')"&gt;open chat window</a> ...

HTML Javascript | how to get a value of a links array

I have a small html code base that produces a list of unique links, I want to get each an every link's text value using java script (not the link only the text). my sample code (doesn't work) for (var x = 0; x < document.getElementById("folderLink").length; x++) { alert(document.getElementById("folderLink")[x].innerHtml); } H...

jQuery code doesn't work when put within head tag

I have a jQuery code that works when I insert it inside a script tag within the body. But it doesn't work when I insert it in the head tag or include it as a js file. ...

prototype - simulate click on <a> tag

How do i simulate a click on an anchor (<a>) tag in prototype? for example i would expect the below code to work in that clicking the 2nd link ("click me") would cause the alert('here'); to be executed. <a id="myLink" href="" onclick="alert('here'); return false;">don't click me</a> <br /> <a href="" onclick="$('myLink').click(); retu...

javascript object property value conflict

I'm not very sure about the question title, here is the situation, please see the following sample code // original data a = [ {x : 1}, {x : 2}, {x : 3} ] // assign to a variable b = a[0] // do some change b.x = 5 alert(a[0].x) // i thought it would still be 1 but it is 5, why??? *edit thank you Amber and Andrei i think...

how to implement IObjectSafety to my webpage page

i have a java-script function (in my html page) that uses active code. i searched in google and found out that i need to implement IObjectSafety to my webpage in order to stop the activex propmt saying "Active X control on this page might be unsafe to interact , Y/N ?" . ...

jQuery UI: Make an item selected?

If I have a list and a link, like this: <a href="">Select</a> <ul> <li>f</li> <li>fd</li> <li>fa</li> <li>fd</li> </ul> <script> $("ul").selectable(); </script> Is it possible to make an item be selected on any arbitrary event? Something like: $('a').bind('click', function() { $('.ul-selectable').children().fi...

JQuery script runs twice

Hi, some JQuery scripts in web page runs twice. What is all about ? Maybe somebody faced such problem ? For example(code that gets total items number from DB and runs in $(document).ready(function(){}); ): $.post("/index/getitemscount/", {} ,function(data){ $('#items_count_div').html(data); }, 'text'); As I see in FireB...

Strange behavior in javascript

I basically have a ul list where each li element is a radio group. I have one other function called showScores which looks like this : function showScores() { //Do heavy processing here } I am using flot plugin for graphs & Paint function actually calls $.plot only ( from flot.js) So basically everytime a user changes any radio ...

how can i chage the color of the stars on mouse hover in this js???

I got a star rating js from http://nofunc.org/AJAX_Star_Rating/ this js works with two colors only,red and blue. When a person moves his mouse on stars then the original rating gets hidden and new rating is shown on mouse move i.e. if we move our mouse on stars then we cant see the original rating unless we move our mouse away from sta...

Programmatically rendering an image from (part of) a DOM element

The (short) question: Are there currently an API's for manually creating images from the DOM using Javascript? If not are there any plans for browser to expose API's for this? The (longer) explanation: I've partially implemented the drag & drop support for rows and columns in the Cappuccino tableview. Currently we have to re-create th...

Need to know JavaScript Charting library for all mobile devices?

Can anyone tell me best JavaScript Charting library for mobile devices spcifically - iPhone,BlackBerry and Android ? ...

No Copy Script for html page

One of my clients would like a No Copy Script on there website to prevent people copying the text off the page. Is there a cross browser way you can do this? I would probably just look at a JavaScript method. I know this can be turned off by people with a bit of knowhow but will do for most cases. ...

Javascript: get element's current "onclick" contents

I have a page with the following code: <a id="test" href="someurl" onclick="somefunction">link</a> I need to actually read the 'onclick' data. As such, I would like something to the effect of alert(document.getElementById('test').onClick) Sadly, it returns undefined. What do I need to do to get somefunction? ...

[jquery/javascript] Check is textarea empty (treating only 'enter' like empty) ?

Welcome, I have textarea and i have small function what allow me to submit message on enter keypress. $(function(){ $('input').keydown(function(e){ if (e.keyCode == 13) { $(".sender").click(); return false; } }); }); That's work fine, i mean great :) Next, i want disallow sending empty ...

JavaScript WYSIWYG implementation

Hi. I want to write a very simple WYSIWYG editor, but i don't understand how do they work :( I've tried to read sources of tinyMCE but stuck in all those classes and functions. As I know they're creating iframe then do some black magic there and everything works. The question is: what do those editors do with iframe so it becomes editab...

Round number up to the nearest multiple of 3

Hay, how would i go about rounded a number up the nearest multiple of 3? ie 25 would return 27 1 would return 3 0 would return 3 6 would return 6 thanks ...

Javascript Contents scroller.

I would like to create a PdfReader like text scroller in Javascript. I mean as I click in PDF Document, a handpointer will be shown and by Moving mouse in any direction the document will be scrolled in that direction if possible. I want to implement this function on a DIV Contents. Thanks. ...

processing a Mutlidimensional HTML array in Javascript

Hi all I've got the following HTML which has been looped around in smarty template language: <td><input type="checkbox" name="confirmRelated[{$relatedIP.ipInt}_{$relatedIP.patternID}][confirm]" /></td> <td><input type="hidden" name="confirmRelated[{$relatedIP.ipInt}_{$relatedIP.patternID}][ipInt]" value="{$relatedIP.ipInt}">{$relatedIP...