javascript

Highlighting lines in different colors in SyntaxHighlighter

In SyntaxHighlighter, is it possible to highlight lines with different colors (say, some lines in green, some other in blue)? ...

Specifying image, text and title on facebook share without meta og tags

I'm trying to build in a facebook share button on a news section of a site. I would like to specify which picture, title and text to use for the share. Due to limitations in the cms that the website uses i can't add the open graph meta in the header of the page. I've tried updating the og meta with javascript and just adding them in the...

Can't bind JQuery Datepicker with asp:TextBox in sharepoint

Hi everybody. I have the next trouble. I am creating the web part in sharepoint. I need a Jquery datepicker. When i try to bind it with the html textbox it works. But when i try to bind it with the Asp:textbox it doesn't work. Does anyone have any ideas? Thanks. I will appreciate any help. <script type="text/javascript"> $(document...

get all the href attributes of a web site

can anybody tell me a way to get all the href attributes(links) in a web site using javascript?if you could give me a code example, i will be most thankful. ...

IFrame on unload refresh parent page

I have an iframe in a page. When the iframe is closed I would like to refresh the parent page. Checking out the iframe element w3 page I see there are no standard events. I considered a polling approach, having the parent page constantly check if the frame is created, and then checking if it is removed and then refreshing, however this ...

ASP.NET - Edit CommandName on LinkButton using Javascript

I have a series of link buttons in a repeater that switch pages <asp:Repeater ID="rptPageLinks" runat="server"><ItemTemplate> <asp:LinkButton ID="lnkNewPage" runat="server" Text='<%# Eval("Page") %>' OnCommand="SomeEventHandler" CommandArgument='<%# Eval("Page") %>' CommandName="Redirect" OnClientClick="return confirm('Do yo...

google analytics js not loading

Hi, I am having problems with ga.js not loading sometimes. In firebug it just shows a connection being tried but it sometimes never makes it. This happens more than half the time and I cant believe that googles servers are not serving the scripts. In fact I can load the ga.js in my browser and it loads fine every time, so why does it no...

Pressing both mouse buttons in Opera

In Opera, on some sites, pressing both mouse buttons simultaneously leads you to some other page, for example, to the separate comments page, when watching a Youtube video. Or to the sitemap on some other websites. May be it is related to Mouse chording ? or is it something different ? How to control this event (disable it or change t...

JS: iterating over result of getElementsByClassName using Array.forEach

I want to iterate over some DOM elements, I'm doing this: document.getElementsByClassName( "myclass" ).forEach( function(element, index, array) { //do stuff }); but I get an error: document.getElementsByClassName("myclass").forEach is not a function I am using Firefox 3 so I know that both getElementsByClassName and Array.forEach a...

Need help with JQuery ToolTip

http://rndnext.blogspot.com/2009/02/jquery-ajax-tooltip.html I want to implement something like the link above..Now this pop up box's fetching data from some page..using PageID and what not...I want the content of that popup box to have simple HTML stuff in it..will bind it later...the one above's got Ajax that I am not familiar with.. ...

Play sound in iPhone web app

Hello, I assume there might be a HTML5 or some JS that can be used to play sound? Before you mark this as duplicate, this question is old, so I believe outdated: http://stackoverflow.com/questions/1694631/play-sound-in-iphone-web-app-with-javascript ...

dynamic object construction in javascript?

When I want to call a function in javascript with arguments supplied from elsewhere I can use the apply method of the function like: array = ["arg1", 5, "arg3"] ... someFunc.apply(null, array); but what if I need to call a constructor in a similar fashion? This does not seem to work: array = ["arg1", 5, "arg3"] ... someConstructor....

Is there a JavaScript regular expression to remove all whitespace except newline?

How do I remove white spaces in a string but not new line character in JavaScript. I found a solution for C# , by using \t , but it's not supported in JavaScript. To make it more clear, here's an example: var s = "this\n is a\n te st" using regexp method I expect it to return "this\nisa\ntest" ...

Javascript library for graph operations

Is there any suggested javascript alternative(s) to pythons pygraph or NetworkX? It should be noted that visualization is not necessary (even prefered not to have this). The library should be able to parse a format capable of retaining labeling and attributes on nodes and edges (DOT, GraphML?). It should support operations such as: Li...

How to post value using loop

Hello, I am facing the problem to post the value of form when using while or for loop. Here is my code. <form name="frm1" id="frm1" method="post" enctype="multipart/form-data"> <?php for($i=0;$i<5;$i++) { ?> <a href="#" onclick="return test1();">Test<?php echo $i;?></a> <input type="hidden" value="<?php echo $i;?>" name="var" ...

regular expressions date

I'm working in javascript and I need to figure out how to determine a valid date using regular expressions matches will be: dd-mm-yyyy dd-mm-yy Also no leading zeros should be accepted like: 9-8-2010 10-6-99 Can anyone help me out with this? ...

Caching external javascript for a QtWebkit widget in a PyQt app

I have a QWebView in my app which renders a html page stored in the app as a Qresource. This page, however requires meaty external Javascript libraries such as MathJax, which I would want to include as a resource due to its size. My problem is that it seems that QtWebkit does not cache these files as a regular browser would do, and eve...

Internet explorer 8 JScript regular expression bug

I'm testing in internet explorer 8 on windows XP and hitting into a tedious bug. I am trying to test strings with a regular expression that works fine in firefox and fine tested indepedantly in the ie8 console. But when it through my closure function the string acts strangly [Edit] more detailed code:- Not as nice or clean as the earli...

How do you handle a UIPickerView in UI Automation iPhone application testing?

In the following UI Automation script code, I'm able to get the values from a UIPickerView, but I'm not able to select the picker: var picker = window.pickers(); UIALogger.logMessage("picker array count: " + picker.length); var pickerWheels = picker[0].wheels(); UIALogger.logMessage("picker Wheel count: " + pickerWheels.length); va...

Conversion tracking with Google Analytics on 3rd party (off-site) shopping cart

Hello, I have the following scenario: The user has an on-site shopping cart where he adds products. When the user clicks on checkout he is POSTed to a script that computes the buy link to an off-site shopping cart and redirects him with the Location header. The user continues with the payment in the 3rd party website. What I need is...