javascript

javascript code to receive Oauth token from blogger using the new api

Hi, I am building a firefox extension that allows users to post to blogger.com, other blogs and social websites My problem lies with receiving the Oauth token for permission or access to be able to post on blogger. I am new in javascript and really interested in getting better, really hurts when you keep cracking at a code for days ...

How do I dynamically change Form Post URL?

I want to make the results of an ASP.NET form POST "bookmarkable", and I'm thinking of using query parameters to accomplish this. The idea is that a user will visit http://domath.com and they will type in a math problem, and view the results. The query and results are visible at http://domath.com?ProblemID={some guid here} The only ...

Create javascript 2D array of incremental values from 1 - 1000 and second value a random number from 1 - 50

Hi, I need to create a 2D array for some POC work. The first value of the array needs to go up in single increments between the values 1 to 1000 and the second value needs to be a random number from values 1 to 50. ...

How to disable a certain radio button in a RadioButtonList in Javascript

I'm at my wit's end when it comes to this. JavaScript definitely isn't my strong suit and I've been trying to google for a solution. Here's the code I have: <asp:RadioButtonList ID="Group1Most" onClick="disable('Group1Most', 'Group1Least')" runat="server" > <asp:ListItem Value="1"> |</asp:ListItem> ...

Best possible SEO way of forcing the iframe'd page to reload as parent.

<html> <iframe src="iWantToBeTheParent.html" /> </html> I think this is a JavaScript task, it would be nice to handle the redirection with htaccess though since my code will inside an iframe I'm looking for a method that initiates from inside the iframe source which would make the iframe url load as the parent. I only have access t...

Setting javascript defineGetter and defineSetter in a loop

Why does each iteration of this: var o = {}; var foo = [['a',1],['b',2],['c',3],['d',4],['e',5]]; for(var i = 0; i < 5; i++) { o.__defineGetter__(foo[i][0], function() { return foo[i][1]; }); console.info(JSON.stringify(o)); } Reset all previous assignments and output this: {"a":1} {"a":2,"b":2} {"a":3,"b":3,"c":3} {"a":...

JSON push not working from ascx

Hi I have a json object that i have declared in the master page. I want to push few elements in it from the ascx controls that are loaded For. e.g. Master page em = { d: [ { ID: "txt_Username", HelpID: "1" } ] } em.d.push({ ID: "txt_StatusUpdate", HelpID: "3" }); em.d.push({ ID: "txt_textarea", HelpID: "4" }); This...

onclick handler not firing for checkbox created with document.createElement

Hello all. I am going insane trying to figure out why this is not working. I am creating a checkbox dynamically with JS to enable/disable a text field (also created dynamically). Code is pretty simple: var text = $(document.createElement("input")); text.type = "text"; container.appendChild(text); ... var check = $(document.createEle...

Cross domain script tag working in FF and Chrome but not IE

We are providing a snippit of HTML that our client can embed on their website to make a callback to our API. This HTML is a simple form and a Javascript file hosted on our server. This is what the client hosts on their website (clientsite.com): <script type="text/javascript" src="http://mysite.com/webcallback/callback_script.js"&gt;&l...

Create bitmap copy of element using canvas

Hello, I've a created a simple page layout program for a client and would like to provide a thumbnail view of pages like the pages palette in InDesign. Is it possible to use the HTML5 canvas element to create a copy of a single element. For example, each page is an article tag. I want to copy this article using canvas and reduce it to ...

Recommended date format for REST API

Hi - I'm writing a app that exposes a REST API. Some of the query parameters will be date/time (accurate to second), and some of the responses will be timestamps (accurate to millisecond). The API implementation on the server is in Java. The client apps can be anything - java, javascript, .NET. The API returns XML or JSON data. Date/T...

How do I use Javascript in my Coldfusion page?

I have a coldfusion page and I am very newbie in coldfusion. What I need to do is to insert the alert in between to see what is the time. In php I could close the php tags and enter the javascript tag and alert out the value. How would I do that in coldfusion? I have this <cfset right_now=Now()> <cfscript> alert(#right_now#...

jQuery - Getting the checked values of any set of checkboxes.

I would like to determine the most efficient way (using jquery, or dom) to get the value of a set of checkboxes if you have one of them. This should be generic when the input checkbox is part of a form. However, is this x-browser safe, how to do this more efficiently, and what if the checkbox is not part of a form? function (domCheckbo...

preventDefault not working in Google Chrome 5

I want to stop a form submit button from reloading a page. This works in Firefox 3.6, Safari 5, and Opera. But Chrome 5 does not prevent the link. Here is the form. <form class="container_7" id="find-store-all" action=" "> <label for="customer-loc" class="grid_3">Find a Store Near You:</label> <input name="customer-loc" id="customer-...

How can I find out which radio button is selected using jQuery without searching for the radio group each time?

I know I can use something described here: http://stackoverflow.com/questions/596351/how-can-i-get-which-radio-is-selected-via-jquery i.e. jQuery("input[name=myradiogroup]:checked").val() to get the selected radio button value. But I'd like to cache the radio group and determine which value is selected at a later point in time. I want...

Using jQuery in Apple Instruments, UI Test Automation

Hi, Is there a way to use jquery when scripting in Apples UI Test Automation. When, in Intruments, I try: #import "jquery-1.4.2.js" I get a warning regarding undefined object window, which is expected since there are no window objects defined, like it would have been in a browser. But, when I try the same on the Rhino JavaScript eng...

Custom Javascript Ajax for ASP.NET

I've written some basic Javascript functions and would like to learn how to enable asynchronous postbacks within a C# 4.0/ASP.net project using this JS code. For example, I have a script that increments a number when clicked. When clicked again, the number is decremented. I basically load the number from a database, then hide one <s...

Password protected website with JavaScript

I have a quetion which may be simple/dumb or not :). In other words I have no idea if is fair enough or a completely foolish idea. Just some free thoughts. What if I make my login via JavaScript with pass in it (yes I know), but pass will be hased by Secure Hash Algorithm. For instance: I generate a pass with SHA which looks like var...

Setting the value of a textarea in jQuery

I am trying to set the default value for a form field in SharePoint and am having a bit of trouble getting the code to work in IE. I have tested Firefox and Chrome successfully. Any ideas why IE would not be setting the value? <script type="text/javascript" src="http://www.qg.com/shared/cache/jquery/142/jquery-1.4.2.min.js"&gt;&lt;/sc...

how to convert object to string in javascript ?

Hi All, Below i have pasted my piece of javascript code here 1) function showCustomerName(dropdown) { var selectedCustomer = dropdown.options[dropdown.selectedIndex].value; var currentCustomer = document.getElementById('currentCustomer'); alert(selectedCustomer); var context = document.forms[0].context.value; document.f...