javascript

find nearest named anchor to an element on a web page in javascript

I'd like to be able to right-click on an element on a web page and get the URL of the nearest anchor. For example, say I'm looking at online docs, and I see a paragraph saying something surprising, then I'd like to be able to right-click on that, choose "copy URL of nearest anchor", then go to my IDE and be able to paste a URL like "htt...

How to change cursor style on element with 'contenteditable' attribute in IE?

I am trying to change style of cursor on element that has 'contenteditable' attribute set to true in IE. <div contenteditable="true" style="cursor:pointer;"> text </div> I have tried do that using inline styling like in example above, also with css file and by javascript but with no luck. All my solutions work in FF without ...

best way to get a callback when a radiobutton is clicked in javascript.

I have got an html like this: <input type="radio" name="v" value="1"> 1<br> <input type="radio" name="v" value="2"> 2<br> <input type="radio" name="v" value="3" checked> 3<br> I want to know how to monitor all of those radio buttons. I could have many more than 3. One thing I though is to have an 'onclick' function for all of them. ...

Central area of Images Unclickable

If one visits http://www.viking.ee/en/windows/tripleglazing/ - where the central play/pause button is unclickable or visits the gallery on the same page, where the images inside the gallery are unclickable there is a general problem with image links not working. I did not build the theme that the site is based on originally (it was boug...

howto upload a file via a single html form to more than just a single server

Sending a file/key to Amazon S3 via a html form and HTTP Post is quite easy and working. But I want to send a file to several S3-compatible sites via HTTP POST and a single html form. How can I do this? As far as I know, HTTP POST can only be directed at a single target location. I want the file to be sent to the first S3-compati...

How to track clicks of ads in email using google analytics?

Hi everyone. I have this problem and really don't know how to solve this. I'm having this newsletter using phplist system and I have to include some ads in emails. Now that's all fine but my client wants to track the number of clicks on those ads using google analytics. Is there any way to do that? Thanks in advance for any hints. ...

Detecting javascript in HTML

Hi, I have two applications where users can submit HTML pages. I would like to make sure that no scripts are included in the HTML. Normally you would escape content to get rid of scripts, but as this is HTML I can't do that. Anyone with good suggestions on how to do that? The applications are written in both C# and Java ...

Preventing Safari default behaviour

How to prevent ctrl+, in safari? I tried preventdefault, return false and stop progpagation also. It seems it cant be prevented. any suggestions??? ...

Form onChange calculation

Hi there, I have a classic asp form to add products to a site. The form has 3 fields of 'Price', 'Sale' Price and a checkbox for 'On Sale'. What i'm trying to do is, when a user enters a 'Price' and ticks the 'On Sale' checkbox, some javascript would complete the 'Sale Price' with a value that is 'Price' - 10%. Wondering if anyone may...

Post array to ASP.NET MVC 2 Controller using AJAX

Hello. There is known trouble with sending array to ASP.NET MVC controller. I've found a lot of solutions like that. Why don't use usual object instead array? It works good. Example of code: <script> $(function(){ $('.asArray').click(function(){ var array = Array(); array[0] = 'Dima'; ...

Display an escaped Json field with Javascript

How can I read an invalid Json returned string with Javascript (jQuery or not)? For example, the first FirstName will not be displayed as it contains an escaped character. So, I will get : undefined. { "ListOfPersons": [ {"Id":1,"FirstName containing doublequotes (ex: \") ":"Foo","LastName":"Bar"}, {"...

How do I access the list of classnames using javascript/jQuery ?

here are the html elements : <input class="myClass problemOne" type=text value=something></input> <input class="myClass problemTwo" type=text value=somethingelse></input> and here is the javascript and jquery in which I am tryign to access classaname, neither method a, or b works ... "classname is null or not an object". var myElem...

Javascript block removing

I really need to remove some block with the help of js. Is it possible not to hide some block, but remove it at all? Because I have a field wich user will not be able to see if he selected "no" in my selectbox, but JQuery validation anyway sends message that this field is empty. I have this: $(function () { $("#wichone...

does python gives interactivity as javascript?

I want to add interactivity like clicks, hover, onpage load() to a webpage, if i use python for generating xhtml, will python give essential flavors like javascript?? I'm bit confused and starter in python for web development, so is there need to include old javascript into python or the python only can handle interactivity, events as j...

Problem initialising Google map with multiple markers

Hi guys, I'm trying to develop an application where addresses are pulled out of a database to show them using a marker on a google map on my website. I have the following javascript code + jquery , google maps and all other necessary javascript files: $(document).ready(function(){ // initialise map var myLatlng = new google.m...

JQuery set cookies.

Hi, How to save div title into cookies? And how to get this saved data, back? <script type="text/javascript"> function setcookie(title, value, exp) { var expdate = new Date(); expdate.setDate(expdate.getDate() + exp); document.cookie = title+'='+value+';expires='+expdate.toGMTString()+';path=/'; } </script> <div title="1" ...

How to stop browser window from jumping on a #ID hash link - simplest javascript required

Hi guys, Got a client who is strictly no javascript, but in this particular circumstance, I don't think I can avoid it. I've got a "next / previous" featured area situation going on using CSS (overflow: hidden and position: absolute) - where the click next or previous (a href="#section...") then brings the relevant div ID into view -but...

inserting html into yahoo's YUI rich text editor

I am trying to insert HTML into the YUI rich text editor. The code works if I use simple HTML snippets, but if I use something more complicated (e.g. try to embed an object), then it fails. Edit Fails - only for FF browser For example - this works: var html = '<div><b><u>Hello world!</u></b></div>'; myEditor.execCommand('inserthtml'...

100% background tile, in 100% hieght divs. problem.

Hi All, I am having an issue with a layout i am trying to develop. I basically have split the view-port into 2 equal width divs with a different background tiled image in each. i have it stretching full screen 100%, but have a problem on scrolling. The background image is cropped to the original height of the view-port..! Here'...

Create a dropdown selection box like "size" in CKeditor

Hello. I want to create a drop down menu in CKeditor like size drop down menu to determinate the line space in text editor. How to construct this plugin. Please Help Me ...