javascript

How to add JavaScript onClick handler to an embedded html object?

I'm trying to add an onClick handler to an embedded object. The handler needs to execute a function which is in an external .js file which is linked to the current html file via <script src=".... Do I need to reference the function differently due to it being located elsewhere? Here is the code as it currently stands (which does not wo...

JSON Parser error.

Hi Everyone, I am using the json parser from json.org to handle data from my application. The problem is that the parser cannot handle some json formats. One request receives the data below. <?php $obj = array("cities"=>array("city1","city2","city3","city4","city5")); echo json_encode($obj); ?> Results in the json below ...

read and parse cookie

Okey im pretty new to php/javascript but what i would need to do is read cookie and then parse some part of it. How can i do it easily? php or javascript or okey. Cookie has something like this info: ssf.2313.1333 and I would need to get middle numrbers (2313). ...

How to load jQuery in JS Bin

Is it possible to run jQuery code in jsbin.com? ...

Possible to refresh browser page from another tab

I have a silverlight application. This contains a "preview" button. Button code is as follows: private void btn_Preview(object sender, RoutedEventArgs e) { HtmlPage.Window.Navigate(new Uri("http://www.google.com"),"_blank"); } When I clicking the button in firefox, a new page is created in a new tab. When I click agai...

space or &nbsp; not outputting in jQuery

Hi all, I have the following being extracted from an XML and being put into a jQuery variable. links.append($("<a href='"+alink+"'></a>&nbsp;").html(desc)); ...however the &nbsp; does not output onto the page. I need this to separate the hrefs on output I have also tried links.append($("<a href='"+alink+"'></a>").html(desc)); ...

Can not use the location object is javascript

Hi everyone! I was making a page with frames. One is a treeview frame, the other is showing a report. When I click the item in the left frame, the report will display in the right frame. But after I click the first item, the location object in the right frame became unavailable! Which prevents me from opening a new report in the same f...

The most similar javascript framework to Silverlight

I like Silverlight because of the following, in brief: -declarative GUI language (XAML) -data and command binding -GUI designer -MVVM pattern -strong typed language. But Silverlight isn't available everywhere. I'd like to investigate alternatives which doesn't involve any browser plugin. Basically javascript frameworks with a compiler t...

(simple) Jquery ajax not returning data

The alert box will display nothing, and not return any data from any URL when it should be showing the google page! Any ideas? I'm using POST because I'm trying to get it to send querystring data as well. $.ajax({ type: "POST", url: "http://www.google.com", success: function(msg) { alert("Data S...

Google Analytics JavaScript client library login method?

Hi, I'm wanting to use the Google Analytics API to display a simple table of "recent visitor" data in my password protected CMS. I would just like to use the supported JavaScript library (http://code.google.com/apis/analytics/docs/gdata/gdataLibraries.html) and looking at the following demo; http://ga-api-javascript-samples.googlecode....

Javascript/HTML, is it possible to create variable names from a loop

Imagine i had: <div id names>142,140,150</names> could i then (in Javascript) write a forloop which declares variable names, with these values appended ie var list = document.getElementById('names').innerHTML.Split(','); for(i=0; i<list.Length; i++){ var 'beginning' + list[i]; } so i'd essentially want to create: var beginning...

Javascript function to get the difference between two numbers

I want a Simple Javascript function to get the difference between two numbers in such a way that foo(2, 3) and foo(3,2) will return the same difference 1. ...

How to detect auto audio flash on the page?

Is is possible to detect within JavaScript of Flash if there is auto audio another flash object (mostly ad) on the page? ...

Javascript Speed - Chrome v Firefox

I wrote this small game at http://amarnus.me/games/dodge. Now if you trying playing the game in both Firefox and Chrome, you would clearly notice that it is significantly slower in Firefox. You can call it an unintentional cheat code, yes. ;-) So my question is - Is this because of a slower Javascript engine in Firefox when compared to ...

Using jquery, how do you reorder rows in a table based on a TR attribute?

I have a table with rows similar to the following. These rows get updated from time to time via jquery calls. Using jquery, how would I construct a function that reorders these table rows based on the myAttribute value putting the highest myAttribute value rows at the top and the lowest myAttribute value rows at the bottom? There could b...

how to count opened newwindows?

Hi everyone, I want to count the number of opened new windows. But, when i close the opened newWindow ,then reduce the window count. My new window have closelink also. May be i choose either closelink or browser close window. Update If i have open 2 new window, then i calculate currently opened window. But, if any window i close...

setting focus on text-box

I am using jquery accordion effect when the clicks on a particular div the content of div appears ,i need the focus on a text-box inside the div? ...

jQuery mouse out and not hiding a particular element

Hello there, Let's say I've got two elements: an anchor which causes an occurence of a particular div. In that single case I'm not able to wrap these two into a parent container, thus the whole markup has to be as following: <a href="#" class="trigger">click me</a> <div class="info">info displayed on trigger hover</a> The very basic q...

client side validation doubts

I have read from one of the blog, for security reasons, its suggested to do the input data validation at the server side not the client side. From the above statement, My mind started to ask then 1) what kind of validation i can do with JS in the client side. 2) Is there any rule where any programmers can decide where the validation n...

Javascript Draw line with jQuery

Please see my code here http://jsbin.com/ijoxa3/edit var drawHorizondalLine = function(x1,y1,x2,y2, color) { var width = Math.abs(x1 - x2); var posX = (x1 > x2) ? x1 : x2; var id ='c_'+new Date().getTime() var line = "<div id='"+id+"'class='line'>&nbsp;</div>"; $('body').append(line);...