javascript

How to calculate approximately the connection speed of a website using JavaScript?

How to calculate approximately the connection speed of a website using JavaScript? I want to create a javascript widget like, which will calculate the speed opening the current opened page. I am asking if this can be done using just javascript and what will be the idea. Update Note that the page size is always Unknown. ...

Adding attributes to SharePoint Web Control

I'm trying to add an attribute to a SharePoint web control: Microsoft.SharePoint.WebControls.BooleanField which basically renders as an html input checkbox control. How do I add an attribute to this? such as an event? Normally for an asp.net web control, you can just do: sampleControl.Attributes.Add("onclick", "alert('test');"); An...

Help with regexp replacing every second comma in the string...

Hello, I have a string of that displays like this.... 1235, 3, 1343, 5, 1234, 1 I need to replace every second comma with a semicolon i.e. 1235, 3; 1343, 5; 1234, 1 the string length will always be different but will follow the same pattern as the above i.e. digits comma space digits comma space, etc. how can I do this with javas...

How do you use onPageLoad in Javascript?

I tried using onPageLoad: function() { alert("hi"); } but it won't work. I need it for a Firefox extension. Any suggestions please? ...

How do you embed other programming languages into your code?

Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into our C# code. To accomplish this, there seems to be two prevalent schools of thought: string blah = "asdf"; StringBuilder someJavaScript = new StringBuilder(); someJavaScript.Append("<script language='JavaScript' >"); someJavaScript.Append("function foo()\...

Making a Javascript drop down menu push site content down?

Hi, i'm new here and I don't know if this is the sort of site to ask such a question. Basically i'm new to web design so I got myself the Sothink DHTML menu builder. A horizontal bar slides down below my menu and I was wondering if I could pass on that effect to the rest of the site, so instead of laying on top of my page content it sit...

Regex to capture variables

I am trying to use an HTML form and javascript (i mention this, because some advanced features of regex processing are not available when using it on javascript) to acomplish the following: feed the form some text, and use a regex to look into it and "capture" certain parts of it to be used as variables... i.e. the text is: "abcde ...

escaping question mark in regex javascript

Hi,..simple questions I think I am trying to search for the occurrence of a string in another string using regex in javascript like so: var content ="Hi, I like your Apartment. Could we schedule a viewing? My phone number is: "; var gent = new RegExp("I like your Apartment. Could we schedule a viewing? My", "g"); if(content.sear...

Best practices for returning and displaying data from AJAX calls.

I have some jquery/php interaction set up on a page. It submits some data to the server and gets back records of data which are then to be aligned on the page for comparison and possible action beyond that. My question is what is the best practice for returning the info and then displaying it? Return JSON object and then create html o...

Can you change z-index with JS in IE8

Very simple example: http://jsbin.com/ohude Click button1, the 'hello2' text p should change z-index to 89. Click button2, the z-index should change yet again. This is obvious in firebug. But it doesn't do jack in IE8. Can someone confirm? Thanks. ...

How to get current page size in KB using just javascript?

Referring to this question , how can i get the current page size in kb, this size i will use to know the connection speed for this page. ...

Are there any guides on converting between Javascript frameworks?

I have a date picker library written for MooTools that I want to port to Prototype. It's looking to be a long arduous task and I'm wondering if anyone has seen or written guides on the differences between the two. A translation dictionary of sorts, where I can look up a Moo function and see the prototype equivalent, or vise-versa. The...

Javascript firefox extension to get the text around the link

Hi, Is it possible for me waiting for a user to click a link, and upon clicking the link the link's text would be obtained? Maybe by using onClick? ...

Concatenate and minify JavaScript on the fly OR at build time - ASP.NET MVC

As an extension to this question here Linking JavaScript Libraries in User Controls I was after some examples of how people are concatenating and minifying JavaScript on the fly OR at build time. I would also like to see how it then works into your master pages. I don't mind page specific files being minified and linked inidividually as...

thumbnail access through for loop.

i am creating a photo gallery and am currently stuck on recognizing which thumbnail links to which pic. im using an addEventListener function, kindly suggest the method to go about. ...

Click Entire Row (preserving middle click and ctrl+click)

I have an HTML table, with a link in the first column. I want to allow the user to click on anywhere in the row to activate that link. At the same time I would like to preserve the middle click and ctrl+click functionality of opening a new tab/window. Here is an example of the table: <table id="row_link"> <tbody> <tr> <...

javascript function inArray

I need a javascript function that can take in a string and an array, and return true if that string is in the array.. function inArray(str, arr){ ... } caveat: it can't use any javascript frameworks. ...

Iterate over a Javascript associative array in sorted order

Let's say I have a Javascript associative array (a.k.a. hash, a.k.a. dictionary): var a = new Array(); a['b'] = 1; a['z'] = 1; a['a'] = 1; How can I iterate over the keys in sorted order? If it helps simplify things, I don't even need the values (they're all just the number 1). ...

Access document of new window in chrome

My goal is to submit a form in a new window. I'm using the following code: var xmlWindow = window.open("getXML.htm"); xmlWindow.document.getElementById("getXML").action = "getData.asp"; xmlWindow.document.getElementById("getXML").method = "post"; xmlWindow.document.getElementById("getXML").innerHTML = "<input type='hidden' name='moduleI...

Simple Jeditable Problem

I just started with Jeditable and for 3 hours now it seems I can't figure it out. This tutorial should have been piece of cake: http://www.appelsiini.net/projects/jeditable , but it turned out to be a little pain in the a$$. I've put the jquery.js and jquery.jeditable.js in the same directory with the main page. This is my code (it see...