javascript

efficient method to replace multiple words in text

Using JavaScript I need to efficiently remove ~10000 keywords from a ~100000 word document, of which ~1000 will be keywords. What approach would you suggest? Would a massive regular expression be practical? Or should I just iterate through the document characters looking for keywords (boring)? Edit: Good point - only whole words, not ...

html menu lists

All, <html> <ul class="menu"> <li> <a href="">Header</a> <ul class="submenu"> <li><img src=""/> Link 1</li> <li><img src=""/> Link 2</li> </ul> </li> </ul> </html> Can the code be changed such that link1 and link2 will appear on mouse over.... ...

HTML table: modify order using mysql

I have a mysql table: (Questions) => question_id(PK), question(varchar), order(int) When displaying the data in a html table: the order of the data is sorted by 'order'. Is there a way to make changes in the 'order' using buttons(move-up/down) then update the order in the database? Thanks in advance! ...

Auto Submitting the Form

Hi, I am facing one problem in the following code , Form is going to submit when i press enter in Keyword text field. there no such enter event bind in java script. Still this problem is happing But when I remove the <form> tag it works fine , Please help .. if there is any mistake <form action="" method="post" id="businessSearchFor...

How do I create the text like this website? (css/javascript)

http://posterous.com/ If you look on the very bottom/right there is "API, Privacy, Terms" They are "shadowed" text. And they have this indentation in them. Is there an easy open-source way to do this? ...

Passing parameters to JavaScript files

Often I will have a JavaScript file that I want to use which requires certain variables be defined in my web page. So the code is something like this: <script type="text/javascript" src="file.js"></script> <script type="text/javascript"> var obj1 = "somevalue"; </script> But what I want to do is: <script type="text/javascript" ...

How to clear browsers (IE, Firefox, Opera, Chrome) history using JavaScript or Java except from browser itself?

How to clear browsers (IE, Firefox, Opera, Chrome) history using JavaScript or Java, except clearing it from browser itself? ...

Javascript string formatting, short question

How can I use javascript to add a number (any number between 0-100) followed by a underscore, before the variable value? Example: 2000 becomes 12_2000 //a number of my choice is added followed by an underscore hello becomes 12_hello The number (12 in this case) is a constant chosen by me! Thanks ...

Javascript Create custom callback

All i need to do is to execute a callback function when my current function execution end function LoadData() { alert('the data have been loaded'); //call my callback with parameters i want Ex. //callback(loadedData , currentObject); } Consumer for this function should be like this object.LoadData(success); function su...

JavaScript inline events syntax

Is there any reason to use one of the following more than the others: <input type="button" value="b1" onclick="manageClick(this)" /> <input type="button" value="b2" onclick="manageClick(this);" /> <input type="button" value="b2" onclick="manageClick(this);return false;" /> <input type="button" value="b3" onclick="return manageClick(this...

How can I return a built-in function as a object property?

This code works, in some cases. If it returns console.log then the call to p.out functions just fine. function Notice(mode) { this.debug = mode; this.out = (function() { if(mode) { if(window.console) { return console.log; } else { return alert...

Using mouseover in CSS

All, var a='<div id="details" onmouseover="tip(this)">'; function tip(el) { $(this).mouseover(function() { var b="<div id='test'>"+el.innerHTML+"</div>"; $(b).css("display", "inline"); }); } Is anything wrong with the above code? I am trying to display el.innerhtml on mouserover next to the hyperlink ...

Parse RSS pubDate to Date object in JavaScript

How would I do this? Tue, 2 Feb 2010 19:34:21 Etc/GMT ...

Set focus to the end of table inside of div when adding a new row.

I have a table within a div with a set height, when the table is bigger than the div the scroll-y bar appear. The problem is that if the scroll bar of the div is at the top, leaving other row at the bottom hidden, and the user press the button to add a new row, this row is added at the bottom of the table, therefore you can't see it. Is...

GET in a For Loop does just one execution

Am trying to make a get request from javascript, with a function called geturl. So if i prepare my querys and add it in to an array, and looping throw that executes just one request. how can do that without a for loop? perhaps doing something with the array? for (var i=0; i<urls.length; i++) { url[i] = urls[i].value...

jQuery contains() with a variable syntax

Hello, I have an "uncaught exception: Syntax error, unrecognized expression: )" in a jQuery application. The code is: <script> $(document).ready(function(){ $('.drag').click(function() { $('.drag').each(function(i) { $(this).addClass('test' + i) }); ...

how can I fill data to extjs component using querystring?

for example if I have extjs ComboBox, and I have URL like http://localhost:8080?param=value1,value2,value3 how can I access this << param >> value in ExtJS, so that I can covert it into something like Ext.data.Array or .... ...

Cufon text z-index (IE6 and IE7 stylish select box bug)

Hello, I'm replacing some text with cufon on my page and I'm using jquery stylish select box plugin (http://www.scottdarby.com/plugins/stylish-select/0.4/) to style select boxes. The problem is that, in IE6 and IE7, select box goes under the cufonized text. (the select box is actually an <ul>). Anyone had this issue before? Thanks, ...

Javascript Date Validation

Hi, How to validate particular format date string using Javascript? I have one date picker which has the display format like "dddd MMMM dd, yyyy"(displaying like this:"Wednesday February 03, 2010".) So i have to validate this format using javascript. Please help me for implementing this.. ...

How to tell if a web page is being exited/unloaded via flash versus via normal HTML

Hi, I have a flash app, that redirects to another page. I'd love to trap any other window unload event (clicking links / submitting forms) and warn the user they'll lose their progress in the Flash app. However, I can't find any way to tell that the click/change of URL/window unload was triggered by Flash vs being triggered by a normal ...