javascript

modrewrite for css / jss minified

I have a web site hosted in a CentOS 5-Plesk-Apache server. I have recently added a second site to the server for serve dynamic content. I have established rewrite rules for images (static content) that works pretty well. The module rewrites the URI in the static server to pointing to the the original file. The problem is that the first...

Client Side Templates in javascript how to bind data

I'm using Client Side templates in my JavaScript. $create(Sys.UI.DataView, { data: data }, null, null, $get("id")); Where i have JSON result in "data", which has 100 record. So ths template binding all the 100 record. How can i efficiently pass required amount of data. ex: 10 record. ...

googlemap-like drag and zoom

How do you develop googlemap-like draggable effects on a set of divs? Are there javascript libraries to simulate that effect? ...

How to hide browser's menu?

I am developing an ASP.NET application for an online quiz test. The set of questions would be randomly selected from a pool of questions. The application works fine, but I want to hide the browser menu option (so that user cannot save or print the test) when the quiz page is shown. I do not want to open a new popup window. So how do I do...

KeyBoard Navigation for menu using jquery

I am trying to add keyboard navigation to Menu(ul li based ) , i have bound the keydown event to menu (or should i bind keydown to the document ?) the handler function used is given below KeyDown: function(e) { var toFocus = false; if (e.keyCode == 38) { toFocus = $((e.target/* li */).next()[0]); ...

Changing a CSS rule-set from Javascript

Hi Guys, Is it possible to make changes to a CSS rule-set dynamically (i.e. some JS which would change a CSS rule-set when the user clicks a widget) This particular CSS rule-set is applied to lots of elements (via a class selector) on the page and I want to modify it when the user clicks the widget, so that all the elements having the ...

ASP.NET: dynamicly generating HTML, how to?

I've been doing ASP.NET a little bit (on and off) over the last year, but I've never come upon this challenge: I'm building a website right now which is quite simple, mostly based in HTML and Javascript. However, on one page, I need to read an XML file off the server, parse it, create HTML from values contained in the XML file, and outpu...

Finding the offset client position of an element

Hi all, How to find the offset client position of an element using Javascript? (I assume the same code can be written in a BHO or Gecko/NPAPI). The problem I am facing is a way to find out the offset client position of the element. The e.srcElement.offsetX/Y does not give the correct value always (same goes for clientX/Y). In some cas...

Find matching strings using RegX in Javascript??

Hi, I have a requirement to filter out some of the specified strings in a given line using regx.. This can be easily achievale using string.macth(). But my requirement is little bit tricky. I have set of keywords, that needs to be identified in a given string. (My input string contains only one expected keyword). I have to form the reg...

Find and execute Javascript fragments in a bunch of HTML

I need to detect and eval the Javascript code contained in a string. The following code works, but it only evaluates the first <script>...</script> it founds. function executeJs(html) { var scriptFragment = "<script(.+?)>(.+?)<\/script>"; match = new RegExp(scriptFragment, "im"); var matches = html.match(match); if (mat...

startswith in javascript error

I'm using startswith reg exp in javscript if ((words).match("^" + string)) but if i enter the characters like , ] [ \ / javascript throwing the exception. Any idea? ...

Qt4: How to call JavaScript functions in a page from C++ via QtWebkit?

Greetings everyone, I'm trying to write a simple log viewer using Qt4's WebKit port/implementation. My HTML code looks like this: http://pastie.org/613296 More specifically, I'm trying to find out how to call the add_message() function which is defined in the <script> section in the HTML document from my C++ code. // Doesn't work...

Javascript prototype extension method

i'm having a prototype model where i need to include the following extension methods into prototype. String.prototype.startsWith = function(str){ return (this.indexOf(str) === 0); } Example: [JS] sample = function(){ this.i; } sample.prototype = { get_data: function(){ return this.i; } } In the prototype model how can i use ...

Can you tell me a good Java Date formatter to parse a Javascript Date object?

Hi, clientside I have some scripts that send to the server some strings... one of which comes from a Javascript Date object. Now, it has it own formatting and I was just wandering if is there a class that does the right conversion, as I am experiencing problems with SimpleDateFormatter... ...

Googlemaps - removing previous marker

After some advice on how to clear markers on googlemaps, I have a map which I would like to have only one marker showing (basically the last marker clicked). I would like the user to be able to change thier mind and click multiple times, but not have confusing map of previous clicks etc. I have tried the map.clearOverlay(); function, bu...

Is there a way to add additional behavior to jquery's $.ajax function

The problem is the following. We have lots of ajax call via $.ajax function. Now I would like to add some loader indicator that will show up when ajax call started and disappear when ajax call finishes. Is there a way to extend jquery's $.ajax function with this kind of behavior. Of course it is always possible to search for all $.ajax...

Calculating the difference between two dates

I have tried like this <script type="text/javascript"> var date2=02/09/2009; var date1=03/12/2009; var diff = date1.getDate()-date2.getDate(); alert (diff); </script> but it's not working, is that reason getDate will work only for Date? How to find the difference between these two dates? Am I not able use this ...

Regular expression for URL validation (in JavaScript)

Does someone have a regex for validating urls (NOT for finding them inside a text passage)? JavaScript snippet would be preferred. ...

Javascript or jQuery passing ID values to show or hide a selected Div

I have a table which is outlined below, this is generated from an old XML file using XLST, to style the page, these files "CANT" be modified by myself, but all have a general template base to them... and all use the goTab() function to show or hide a specific div <table cellspacing="0" cellpadding="0"> <tr> <td class="tab_active" id="ta...

javascript wont parse php html tags

php sends html strings to html via ajax wrapped in <p class="select"></p> tags, css reads class perfectly. javascript/jquery does not. javascript/jquery wont even parse <p onclick="function()"></p>. What am i doing wrong? heres my php (sends data via ajax fine) echo "<p class='select' onclick='populate();' >{$row['song_name']} </p>"; ...