javascript

Prevent single word of being edited in a Textarea

Hey guys What I want to achieve is the following; I have a textarea filled with text in our CMS. That text contains some special strings that are variable names. In the site these variables are replaced with something else (e.g "$!test;" will be replaced with "Hello this is a test"). Now I want to prevent the users from editing these s...

onclick and onclientclick

I have the following line in asp.net <asp:LinkButton runat="server" ID="createuser" OnClientClick="javascript:$('#dialogform').dialog('open');" onclick="AddCaseInfo_Click">Create Case</asp:LinkButton> onclientclick works fine, but not onclick. I tried OnClientClick="javascript:$('#dialogform').dialog('open');return true;" ...

If user clicks on one link then quickly on another, the second link's onclick doesn't fire. How do we avoid this?

Hi there. Apologies for the title, I found it hard to define my question succintly and that was the best I could do. If someone wants to edit it to add a better title then please, be my guest. Anyway, the question. We have on our webpage the capability for users to delete something. They do this by clicking on a delete link, something t...

Documentation for SO reputation graph (Flot)

Hello, is there any documentation available to build Flot graph similar to what we can find in the SO profile/reputation tab? from the source code I can see that data is queried at this address: /users/rep-graph/341106/" + ranges.xaxis.from.toFixed(1) + "/" + ranges.xaxis.to.toFixed(1) but I don't know the values from and to fields i...

Renaming object keys(variables) in javascript

Hello, I am having an object with variables named [0...10] and few variables with normal names. I delete one of them with delete obj[3]. Then there is a gap in this sequence. I want to arrange them now from [0...10]. My first though is to loop through and rename keys(variables). How I can do it? P.S. - Object cannot change its structu...

How to detect end of scrollbar?

How to detect end of scrollbar? ...

How to edit CSS styles in JavaScript?

So for example I can do this: document.getElementById('element').onclick = function() { document.getElementById('element').style.color = '#FFFFFF'; } But how should I do this? document.getElementById('element').onclick = function() { document.getElementById('element').style.-moz-box-shadow = '1px 1px 1px #000'; } I hope y...

Variable not sent to other function

I have a number of links, that when clicked on, passes a variable thru to another portion of the page. Yet, for some reason, I can’t figure it out! What am I missing? <head> <script type="text/javascript"> function myFunction(a){ myid="Hi There!"+a; return myid; } </script> </head> <body> <a href="#" OnClick="myFunction(123456);"...

create <image> in <td>

I want to add an <img> in a <td> $myRow = $("<tr></tr>"); $myRow.append("<td>$('<img/>').attr({ src: 'xx' })</td>"), as expected it's considering it as a string. How to format this using jQuery, so that it creates an <img>? ...

remove appended html

$(function() { if(map_flag == 0) $("#buttons").append('&nbsp;&nbsp;<input type="button" value="Import" class="ui-state-default ui-corner-all" onclick="javascript:import_q();" />'); }); function upload_1() { $("#buttons").val(''); $("#buttons").html('') } In upload_1 function how to remove the ...

Javascript Math Error: Inexact Floats

Possible Duplicates: Is JavaScripts Math broken? How is floating point stored? When does it matter? Code: var tax= 14900*(0.108); alert(tax); The above gives an answer of 1609.2 var tax1= 14900*(10.8/100); alert(tax1); The above gives an answer of 1609.200000000003 why? i guess i can round up the values, but why is t...

Jquery-Ui Dialog / Draggable bug with chrome

Hi I made a dialog with jquery-ui, it's draggable. Inside the title bar i created a simple input with a counter. surrended by 2 arrows (to navigate between records). Everytime I click on the title bar, it begins to drag but if I release the mouse button while in the input, it's like it does'nt consider i released the button and it keeps ...

Calling Twitter's verify_credentials from JavaScript

Hello, I have a user that has been authenticated via OAuth. I am trying to call the verify_credentials function from JavaScript. Unfortunately, I cannot figure out how to do this. Nor can I find a good example. Can someone help me out? I guess I suck worse at JavaScript than I thought :) ...

How to activate PHP file in JavaScript function

Hello all, I am trying to write some information into my database when I activate a javascript function. I use PHP and MySQL. How can I open the .php file, execute it and return to .js file in order the function to continue its operation? Thanks in advance. ...

Creating and populating a select dynamically

I have 2 tables, Provinces and Districts. I would like to populate a select field with options as District names based on which Province is chosen in another select. The Districts table has a ProvinceID field to reference which Province it belongs to. I know this is doable, I just can't figure it out. I also want to create and update...

Javascript function only works once

I have an inline script on my page as such: <script type="text/javascript"> var rootPath = '<%= Url.Content("~/") %>'; $(document).ready(function () { $('#logonStatus').click(function () { loadLoginForm(); }); alert('Document Ready'); }); function loadLoginForm() { if(!serenity.tools.isStyleSh...

An Ajax request is taking 6 seconds to complete, not sure why

I am working on a user interface, "dashboard" of sorts which has some div boxes on it, which contain information relevant to the current logged in user. Their calendar, a todo list, and some statistics dynamically pulled from a google spreadsheet. I found here: http://code.google.com/apis/spreadsheets/data/3.0/reference.html#CellFeed th...

How to set default view in OpenLayers, WITHOUT restricting bounds?

Based on samples, I can see that you can set a default view in OpenLayers by saying something along the lines of: var bounds = new OpenLayers.Bounds(-125, 25, -65, 50); var map = new OpenLayers.Map('map', {restrictedExtent: bounds }); However, this also (as the name implies), restricts me to be able to ONLY navigate within these ...

how to determine when a request in completed in mootools?

Hi, I am new to moootools and I am creating a Template class,This is my code - var Template = new Class({ Singleton : true, template : '', /* gets the component type template */ get : function(componentType){ var tplUrl = Core.getUrl('backend') + 'response/' + componentType + '/get_template.php', that = this, ...

autocomplete structure problem

I'm lost here and I really need a kind guru to help me out and to have A LOT of patience. Here is, more or less, the general workflow: The user types something on a input element; Onkeyup, it will grab values from our backend script, and choose one. After choosing, onblur, we will grab that value and use it to query the database for s...