javascript

Hashing JSON in PHP does not produce the same result as in Javascript for unicode characters

Hey! My web application communicates with the server over JSON protocol. Before sending each JSON message from the web application, I run a hmac-sha1 function on it (on already encoded object) and insert the resulting HMAC into the header of JSON request. On server side, I decode JSON message with PHP, extract the HMAC, unset() the HMA...

Is this most efficient way of setting a select/option box with javascript?

Is this most efficient way of setting a select/option box with javascript? <select id='sel_activity'> <option value='CYC'>Cycle Count</option> <option value='INV'>Inventory Count</option> <option value='INVDROP'>Inventory Drop off</option> <option value='INVPICK'>Inventory Pick up</option> <option value='TRAIN'>Training</option> </selec...

how to select elements with specific id without using javascript frameworks?

hi guys, I am trying to find the list of elements that matches the specified id format. like I want to select all the tags with classname "required" or select all the tags with id like myObj[any char] eg. myObj1, myObj2, myObj3, myObja etc ...

Gigya Logout Issue.

Hi, I am implementing gigya to authorise users from facebook, twitter, linkedin and gmail. Everthing works great as I need very little information. I am using socialize logout to logout users, but It does not work as desired, It logs out of the hosted site but not the service provider. Is there any option that I might have overlooked ...

trigger onresize in cross browser compatible manner

I would like to trigger the onresize event from my C# code behind. I think this can be done with Page.clientScript.RegisterScriptBlock(this.getType(), "id", "javascript code"); I have tried element.onresize() but it doesnt seem to work in firefox. What is the correct way to trigger an onresize event similar to the following jQuery? ...

how do i refer to the parent object value in child function in javascript

hi guys, I have my object defined as follows: function KoolTabs() { this.targetName = ""; this.activeNode = 1; this.init = function() { this.targetName = arguments[0]; this.activeNode = (arguments[1] || 1); this.setEle( this.activeNode ); this.findNodes(); } this.findNodes = function() { for (i=0...

disabled control being reenabled but still not posting back contents to server

I have a couple of radio buttons that are controlling text entry into a textarea. <tr id="trTextNote" runat="server"> <td colSpan="2"></td> <td class="IndentedCell" noWrap colSpan="2"> <asp:textbox id="txtIncludeNote" runat="server" Width="352px" Height="46px" TextMode="MultiLine" MaxLength="250"> </asp:textbox> </...

Can an input (type=text) be a jQuery droppable?

Hi, I am trying out jQuery-UI drag-drop feature. I was able to easily convert a div into a droppable but making a text box a Droppable doesn't work. jQuery('input[type=text]:visible').droppable({ drop: function (e, ui){ console.log('dropping',ui); //--> this never gets called jQuery(this).val(jQuery(ui.helper).text());...

Readonly input box bug in Internet Explorer

Hi all! I've got a strange bug, well, MSIE does. Seems it is failing on all major MSIE versions: 6, 7, 8 and 9 (!) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" ><head><title>test</tit...

ASP .NET Validators broken in FireFox

Hi, I'm struggling with ASP .NET Validators JavaScript issue. Following function (part of framework generated code) tries to access validatioGroup attribute value using control.Field syntax. It works fine in IE, however in FF that value is always undefined. Consequently, validation always passes and my validation scenario is broken... I...

Is querySelector supported by all browsers?

hi guys, I would like to know is querySelector supported by all browsers? is not what's alternate for it to use? I have tested it with IE8, FF3, Chrome 4. Its fine for me. I do not have old browsers. So i would like to know if old browsers will give problem to me or not? ...

Notifying users of database changes

I have, at its heart, a php/mysql application. Every ~15 minutes new data is added to the database. I want to notify users that new data is in the database. I was thinking of having some JS run on the clients computer to check for updates every 60 seconds, but I don't want to pull down the results unless something has actually changed/be...

Javascript/<text area >

alert("..."); var values = "value1 valu2part1 value2part2 value3 valu4"; alert(values); I assigning var values = "<%=Model.Values%>"; this values are stred in a databse .this values are entered through a textarea and in database each line is seperated by \t\r when i take this toa javacript varable using var values = "<%=Model...

How to get a html element by name

Is there a way in java script to get only a particular name instead of using document.getElementsByName("x"); which return an array? I have a kind of special situation where i can’t use the id. Any suggestions please? Thank You. ...

Descriptive error messages

I have the following jQuery which does not give the most descriptive error messsages... url: 'server_page.aspx', type: 'POST', data: { intID:$(this).attr("id"), strState:"1" }, error: function() { alert('Error'); }, success: function() { } How do I get more descriptive error messages if it is possible? EDIT: This is the full javasc...

How can I use Simple Modal to scroll to the top of my page just before the modal launches?

I'm successfully using Simple Modal to launch a modal when a button is clicked, however, I want the page to scroll to the top first. I tried placing an anchor tag at the top of the page and referencing it in my link using , but it didn't work. The Simple Modal still worked, but it didn't scroll to the top of the page first. Is there a...

Code Snippets: Where do I keep them?

Is there a tool or process for keeping your functions, selectors and 'for loops' handy and search-able for future use? I use nothing and am re-learning occasionally for a similar problem I've already solved. background: I'm progressing into jQuery and Javascript and am starting to see some repeating patterns like building complex selec...

Edit contents of embedded SVG file using javascript

Hello! I have an SVG file with some math equations. Lets say I include this file into my html document. Now what I'd like to do is to make some simple modifications to the contents of the svg using javascript in the html document. A specific example My svg file contains a nicely formatted version of this equation: x^2 + 2x + 1 = ...

In javascript, how can you assert that two items are equal?

I am running Rhino and trying to determine how to do an assert_equals() or its equivalent in Javascript. From the Rhino shell I can load qunit, but I can't create an assertion that will fail. What is the easiest way to use assertions in Javascript? I will be using Javascript in environments other than a web browser, so knowing how to d...

Put todays date on click in several textboxes

Hi. I have several textboxes, 6 to be precise. What I want is that whenever I click one of them, the current date appears on the box I just clicked. I have this so far: function dat() { var year=document.frm._data1 var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime...