javascript

fade in div on page load

I need a div to fade in when the page loads. <div id=monster></div> Im already using jquery FYI. Thanks in advance. ...

On what browsers does a <script> tag appended to the document get evaluated automatically?

On many browsers, if I do: var x = document.createElement("SPAN"); x.innerHTML = "<script>alert(1);</script>"; document.body.appendChild(x); no alert will happen. Are there any browsers for which it will happen? If so, which ones? ...

Is there any onDocumentChange event?

Is there any event in Internet Explorer, that is fired whenever DOM is changed? For example: document.attachEvent("ondocumentchange", function () { alert("you've just changed DOM!"); }); And when I execute: document.appendChild(document.createElement("img")); Window with text "you've just changed DOM!" appears. I try to emulat...

How to return name of the property an unnamed function is assigned to

Hi guys I got following code: function test () { this.testFunction = function () { //code to alert or return the string "testFunction" } } var testVar = new test(); testVar.testFunction(); Is there a way to find out the name of the property, which the unnamed function is assigned to? Whatever I tried yet in conjunction...

jQuery - Fading animation on hover

Hi! I have a little jQuery animation which fades in a link when hovering an : $(function() { $('.delete').hide(); $('#photos img').hover(function() { $(this).parents('li').children('.delete').fadeIn('fast'); }, function() { $(this).parents('li').children('.delete').fadeOut('fast'); }); }); But if I quickly mouse my mo...

Detect programmatical changes on a html select box.

Is there a way to make a HTML select element call a function each time its selection has been changed programmatically? Both IE and FF won't fire 'onchange' when the current selection in a select box is modified with javascript. Beside, the js function wich changes the selection is part of framework so I can't change it to trigger an on...

WebKit width not updating?

I have a piece of code which runs on window resize. I am pulling the width, and the outerWidth of a input text element. This process works fine in every browser, except Webkit, which returns the proper result from outerWidth, but the result from width never changes from the on load original. This is actual console output from my script...

jQuery Select Menu Replacement

I have a select drop-down that selects a theme for the current page the user is on: <select id="style" name="acct-stylenum"> <option value="1" selected="true">Light</option> <option value="2">Dark</option> </select> Now what I would like to do is add two divs that will also control this select menu. I would...

Cannot click on SWF when small size in Mac OSX

I have this website here http://www.innovie.com/morgan If I use PC, I can drag and change volume on top left just fine. But if I use Mac OSX, either Safari or Firefox, I cannot drag the volume in the Flash, although I can see the mouse turn into pointer. Can someone help on why? Where is the SWF: h**p://www.innovie.com/morgan/sound.swf ...

Select tags within a string using jQuery

Hi all, I have my website getting a value as a result of an ajax call. After that, I would like to insert that result (a string) into a tag. However, I would like to insert that result in a way that (1) it must have opacity = 0, then (2) it will slideDown() so the whole content list being pushed down using animation, and finally (3) cha...

Remove a JSON attribute

if I have a JSON object say: var myObj = {'test' : {'key1' : 'value', 'key2': 'value'}} can I remove 'key1' so it becomes: {'test' : {'key2': 'value'}} ...

jQuery Plugin Namespacing Functions

I'm creating a jQuery plugin that that is rather large in scope. In fact, the plugin technically consists of a few plugins that all work together. (function($){ $.fn.foo = function(){ //plugin part A } $.fn.bar = function(){ //plugin part B } $.fn.baz = function(){ //plugin part C } }(jQue...

simple jQuery - I can't figure out why this isn't working...

I am trying to do 2 things: 1: append a div to the body 2: make all clicks to links class 'editlink' make a popup and not go to their href Doing just #2 is fine: $(document).ready(function(){ // $(body).append("<div>Hello world</div>"); $("a.editlink").click(function(event){ alert("Javascript-endabled users should see this"); ...

Why would I put an ID on a script tag?

I've noticed that some web developers put IDs on scripts tags. For example: <script id="scripty" src="something.js" type="text/javascript"></script> I know that according the W3C this is perfectly legal markup, but what's the benefits of doing this? ...

Javascript/JQuery HTML Encoding

I'm using Javascript to pull a value out from a hidden field and display it on a textbox The value in the hidden field is encoded. e.g. <input id='hiddenId' type='hidden' value='chalk &amp; cheese' /> gets pulled into <input type='text' value='chalk &amp; cheese' /> via some JQuery to get the value from the hidden field (Its at t...

Dynamically Adding Listeners To Google Maps Markers

I'm working on a page which fetches code with a Javascript httpObject and uses it to update two elements on the page - a google map, and a DIV that lists the things the marker points to. That bit works fine. The problem is that when I create the markers, I do so through a for loop, and I add listeners to the marker in each loop. Then,...

How to provide feedback while loading thumbnails and control the load order

I'm building a website with around 250-300 thumbnails on a single page, contained in 5 different divs which can each be scrolled horizontally. During the loading stage, however, I need to be able to click on a thumbnail and load the full-res picture in the lightbox. I've looked at Jason Buntings answer in How to display loading status w...

Close all popup windows with Javascript

Does anyone know how can I close all popup windows (window popup by javascript) in Javascript? Example: Open 3 new windows by clicked on a button, and using window.open() to open all 3 new windows. Clicked on a button and close all 3 popup windows togather. ...

how to append a number to a function name to create many functions ?

Hi all, i ve a function which is responsible for some validations, disabling and enabling of some text boxes and a group of radio buttons .... now i want to generate the function name to be called from another function using a for loop and then appending the for loop index to the function in question .... something like this ..... f...

How does the "let me google that for you" site make an animated mouse?

How can I make an animated mouse move across the screen and click a button? It would be good for demonstration purposes! Ideally, it would be in javascript and/or jQuery. EDIT: there is a gigantic javascript file that the page calls, and that would take me a long time to parse and understand. That is why i am asking ...