javascript

Highlight a section of an image in JavaScript

Hi Guys, I run a small webpage that allows users to click on various links using image maps. I'd like to highlight the section that a user clicks on to give some feedback to the user (they may be clicking on several different parts rapidly). Is there a way I can invert (or otherwise highlight) a small section of an image JavaScript?...

Select first element that doesn't have a specific class

I want to write a selector that targets the first element that doesn't have a specific class. <ul> <li class="someClass">item 1</li> <li>item 2</li> <-- I want to select this <li class="someClass">item 3</li> <li>item 4</li> </ul> I know how to select all elements that doesn't have "someClass": $('li not:(.someClass)').dostuff(); B...

putting content from iframe into current DOM

Morning all. I have the folowing problem: $(document).ready(function(){ $("#actContentToGet").load(function(){ var htmlCODE = document.getElementById('actContentToGet').contentWindow.document.body; var elements = []; var z = 1; function alterContent(htmlCODE){ $("#createdDivs").html(""); htmlCODE.$("*").each(function(){ aler...

JavaScript: How do I change the Hash in the Address Bar WITHOUT adding an entry to history?

I'm trying to expand on an idea from someone else's question, and running into difficulty. The idea is to insert the utm_source (from an ad campaign) into the url hash dynamically, have Google Analytics track the page, and then remove the hash. (We don't want to keep the hash because: 1. it's a duplicate page, and 2. If the user bookmar...

JQuery URL Selector to Replace standard XHTML Form Dropdown

I'm certain this is a simple solution, but had no luck pinning down the right approach (just getting started with jQuery). So, here's the question: I have this HTML form: <form id="callSelect" class="full" method="post" action=""> <select name="Single"> <option value="/var-a/">Var A</option> <option value="/var-b/">Var B</opt...

dynamic image gallery

Hey all, my first post :D Problem: I'm trying to make a template gallery, not a slide show, which i can easily reuse on multiple sites. Mostly for quick folio sites, where the owner wont know how to update the code to add pictures. It needs to read all of the image files from a selected directory. (jpg, gif, png, bmp) It needs to be a...

javascript load listener

I would like to know if this would be possible in javascript: i have an application, mainly developed in javascript. There are ajax calls fetching html content scattered all around the code. I would like to create an object that listens whenever a load function is being called, and launch a function in that case (like displaying a prelo...

How do I calculate the width between two elements?

Hi, I need to calculate the width between two elements but I'm not sure how I would go about this. Say I have the following: <ul id="foo"> <li style="width:10px;"><a href="#">1</a></li> <li style="width:20px;"><a href="#">2</a></li> <li style="width:30px;"><a href="#">3</a></li> </ul> How would I calculate the distance bet...

getElementById from iframe

Hi, could someone help me to understand why this errors document.getElementById("actContentToGet").contentWindow.document.body.getElementById is not a function function deleteElement(element){ var elementID = $(element).attr("class"); alert(elementID); document.getElementById('actContentToGet').contentWindow.document.body....

Programmatically Calling Browser Right-Click Menu Options?

Hey there, I would like to be able to programmatically invoke the right-click menu options, initiated from user events like rollover and whatnot of course. Is this possible? Specifically, I would like to be able to call the Safari "Use Image as Desktop Picture" or the "Add Image to iPhoto Library", or the Firefox "Set as Desktop Backg...

javascript cookie, little help please...

I am displaying a div on my site, and I want to only display this div 5 times that the user has visited my site. So after 5 times, it wont show the div anymore. I can do it with cookies. But Im only familiar with PHP. Javascript isn't my strong side. Does anybody have a short piece of code to set a cookie, increase it for every visit, ...

Javascript 2.0 classes

I'm reading a book "How to Do Everything with JavaScript" and I'm currently learning how to define classes. The book says there are 2 ways. first using functions in javascript 1.x. second, using class in javascript 2.0. what I'm trying is: class Car { var Make : String; var Model : String; var Year : Integer; var Color : String; var Fu...

PHP counter disappears/reappears

Hello, I am not a programmer! So please be patient and I hope I explain this OK. I downloaded a script to run a very basic counter on two of my website's pages. Since April 2009 it's run beautifully, but in the last three weeks it would suddenly disappear, then reappear occasionally. This week it's every day.At first the counter just di...

Programmatically Bookmark Link with Javascript Cross-Browser

Is there a script out there that solves this problem? I would like to be able to say "onclick, save as bookmark". I have searched around a bit and found this one, but it doesn't work with Safari. Anyone have a solution for Safari? ...

JavaScript, DOM blur/focus, dropdowns

I am building a rich text/wysiwyg editor component in HTML and JavaScript. I have an unordered list of toolbar items which contains an image input element for a colour picker. The colour picker is an overlay which is displayed on the click event of the input element. The problem: I want the colour picker overlay to hide when focus is l...

Clear all script-set variables easily (Javascript/jQuery).

I'm trying to find a simple way to reset all current variables in the DOM. My app has a 'locked' state, but currently, when locked, the last set of information is still visible in the DOM if you look using Firebug for example. I know all the names of all variables, but I don't want to have a really cumbersome script including all of the...

JQuery UI Tabs - dynamically adding and removing mouseover event

I would like to add a mouseover event to a UI tab strip when user clicks on a checkbox, but I am trouble dynamically adding and removing events. Here is what I have so far. <script type="text/javascript"> $(function() { // add mouseover event when user clicks on checlkbox called chkbEnableMouseOver $("#chkbEnableMouseOver").ch...

firefox view source code

I noticed that the source code shown in Firefox appears to be incomplete. I have the latest version. When using the Firebug plugin to look at a webpage, I am able to find elements which are simply not recognized by Firefox. This is for a automated script I am working on. I am wondering several things: Why is a firefox plugin able to...

getting `distance` of scroll

Hi, usinf javascript is it possible to work out the distance, or how far in pixels a window has been scrolled down? Regards Phil ...

Ext.Direct Login Form Question

Hello there! I have a problem with my ExtJS code. result is undefined [Break on this error] if(result === true || result.success){ This is my ExtJS code: var login = new Ext.FormPanel({ draggable: false, labelWidth:80, frame:true, title:'Please Login', defaultType:'textfield', monitorValid:true, buttons:[{...