javascript

set a:visited style with javascript or jquery

How I can set a style of a:visited with javascript or jquery. I know how to set with a regular link like document.getElementById('a12').style.color = '#ff0000'; But I don't know how it work with a:visited? ...

Use JavaScriptSerializer to produce object with arbitrary property names.

In .Net, I want to generate a json object as follows: {"1":true} Can I do so using JavaScriptSerializer? Can I do it any other way? ...

FCKeditor remove all font sizing, color, and font family on paste?

I am trying to remove all font formatting styles upon doing ANY paste into FCKeditor. Specifically because of the inconsistent way FCKeditor handles pasting between browsers when pasting from Word using different methods (using the toolbar button, Ctrl+V, or the edit menu). I read this http://drupal.org/node/630156 specifically the comm...

JS (function(){}) syntax

Possible Duplicates: Why would one write global code inside a function definition-call pair? How does the (function() {})() construct work and why do people use it? I'm no JS ninja, and I'm now trying to learn the ins and outs of a language that has a lot more depth than I thought! I've seen a lot of code recently (jquery a...

Why does Firefox mess up page loading if I use a cache manifest?

Hi all. I have developed an html5 game which I also want to play offline, so I decided to add a manifest file. The game is in a subdirectory, e.g. /games/game/ and the manifest is in that directory: /games/game/application.manifest. But the game depends on serval site-common files stored in /js and /css OUTSIDE the game directory!!! The...

Safety precautions while doing html form processing using javascript, PHP, MySQL

I am not a professional web developer but I love web development as a hobby.. I am a student and I was asked to make a departmental event web site. I need to create HTML forms for user registration. I am aware of XSS Scripting attack and SQL Injection. But don't know how they exactly work. I am using PHP and MySQL on server side. I am t...

Get Element By using Class name

Hi Guys I want Element by using class name Now I am using GWT 2.0 Please help me Thanks ...

Google Maps API Marker Images not showing in Internet Explorer

Hi, I'm using Google Maps API Javascript V3 and I have a problem where in Internet explorer, my marker images aren't appearing but according to Adobe Browserlab, other browsers have no problem. The coordinates are being read from a div called "hidden". Here is my code: <script type="text/javascript"> function initialize() { var cent =...

capturing number from html text

i want to capture phone numbers from an html document. I have used a pattern but its also selecting numbers that are the part of attributes of tags. var myArray = $('body').html().match(/([\s()-.])*(0[1-9]|[+][1-9]|[+][+][1-9]|00[1-9])(([\s()-.\/])*[0-9]+)*/g); ...

Is this javascript encoding properly written?

I have tried some tips I was given on regards URL encoding but I have no success so far. First, I was given this format, var url = "http://www.polyvore.com/cgi/add?title=" + encodeURIComponent(%%GLOBAL_ProductName%%) + "&url=" + encodeURIComponent("http://lilaboutique.co.uk/products/" + encodeURIComponent(%%GLO...

Getting the remote address from a <script> tag.

Hi! I have a page with a tag in it pointing to a php script that generates javascript. In this php script, I verify the remote ip to see if this ip has the right to use the script. My question is: how do I get the IP from the machine that embeds the tag? In $_SERVER, I have REMOTE_ADDR which is MY ip address (the client) and SERVER...

jQuery UI accordion that keeps multiple sections open?

I may be an idiot, but how do you keep multiple sections in jQuery UI's accordion open? The demos all have only one open at a time... I'm looking for a collapseable menu type system. ...

Is there a built-in function that comma-separates a number in C, C++, or JavaScript?

Given a number 12456789, I need to output 12,456,789 without much coding. Are there any built-in functions in either C, C++, or JavaScript I can use to do that? ...

Which is quicker; Comparing text against an array, or an external file?

I have to implement a "bad words" filter on my website, which is a classifieds website. I have a big list of "bad words" but don't know which method is best to compare the user inputs to. In my case, a textarea inside a form, needs to be checked for "bad words". <form name="test" action="test.php" method="post"> Inside test.php I...

What kind of JavaScript is this?

I have an application that has this format scattered around but I dont know what kind it is. It's not jQuery, so what is it? $('some_edit').style.display = "block"; $('some_views').style.display = "none"; I get this in firebug and I know the element is present: $("some_edit").style is undefined ...

jQuery Link Fading. Help!

I am trying to animate my navigation menu with jQuery Link Fading effect. I got the script from David Walsh Blog. I've put 3 test links right above my main navigation menu. It works fine, just as I expected it to. But when I add the class="fade" to the <ul id="topmenu" class="fade"> like so: <script type="text/javascript" src="jquery.d...

JAVASCRIPT / AJAX : Why I'm NOT getting xmlhttp.readyState 1 and 4 ?

My Problem xmlhttp.readyState is always 2 then 3 in firefox and other browsers in Internet Explorer the opposite, and 1 and 4 is missing. My Code function like(id,type){ if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 ...

Adding rows and columns to a table dynamically with jQuery

I have the following JavaScript code: function addRowToTable() { var tbl = document.getElementById('tblSample'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; var row = tbl.insertRow(lastRow); // left cell var cellLeft = row.insertCell(0); ...

Programmatically adding child nodes to a jstree

I'm trying to write some code that adds nodes to a jstree dynamically. I've followed the doc at http://www.jstree.com/documentation/crrm but can't get a simple example to work -- the node child2 is being added, but it is being added to the node 'root.id' rather than 'child1.id' as specified... Any tips would be much appreciated. Code fol...

test if window has focus

Hi all, How do you test if the browser has focus? Thanks, rod. ...