javascript

AJAX and callback function

Hi, I will try to explain my problem. I have 4 files index.html, event.js, start.js and form.php. index.html <head><script type="javascript/text" src="start.js></script></head> <html> <button id="bt" type="button">Click</button> <div id="test"></div> </html> start.js window.onload=init; function init(){ document.getElementById("bt")...

Multiple jQuery UIProgress bars

Hello, I'm trying to display multiple, "static" jQuery Progress Bars on a single page, all with different different values.... Anyhow, say I have this bit of code: $(function() { $(".progressbar").progressbar({value: 37}); }) Is there a way to use the same class for multiple "instances" of the progress bar? And is it possible to pass...

jQuery IE7 size wont update when switching between px and % values on window resize

I'm making a jQuery plugin for full browser flash, which has a minimum size limit, say 800x600, so if the browser is over 800x600 the containing div is set to 100% width/height, it's it's below that size, it's set to 800x600. (function ($, fullFlashMinSize) { var getWindowSize = function () { return { width: $(window...

Why this js code works?

if (!wysiwyg_toolbarButtons) { var wysiwyg_toolbarButtons = new Array( //command, display name, value, title, prompt/function, default text ["bold", "Strong", WYSIWYG_VALUE_NONE, "Give text strength"], ["italic", "Emphasis", WYSIWYG_VALUE_NONE, "Give text emphasis"], ["createlink", "Link", WYSIWYG_VALU...

How to substitute a javascript variable into json?

Greetings all, I have some JSON code that looks like this: { playlist: [ 'URL goes here', { // our song url: 'another URL goes here' } ] } I'd like to stick the value of a javascript variable into the JSON, and have it be substituted in place of 'URL goes here'. Is there a way to do that in JSON? ...

Simplest code for array intersection in javascript

What's the simplest, library-free code for implementing array intersections in javascript? I want to write intersection([1,2,3], [2,3,4,5]) and get [2, 3] ...

Difference between JavaScript function declarations?

Why does calling my JavaScript function throw an error when I call it like this wysiwyg2(); var wysiwyg2 = function() { alert(1); } but work when I do this? wysiwyg2(); function wysiwyg2 () { alert(1); } ...

How can I use .htaccess to send distant expiry headers on CSS and JS files?

I want my CSS and JS files to expire in the distant future. Can I do this with .htaccess alone? How would I do it? I know in the future if I change one I will need to force a redownload, something like this should work script.js?v=12 ...

Which value will be sent by <textarea> and why?

<form> <textarea name="test" value="no"> hi </textarea> <input type="submit" /> </form> hi or no,and reason? I ask this question because I see javascript editors use textarea.value = html; to restore the content when submit,why they do this if value attribute is useless? ...

URL based Javascript to show all variables in the page

Hi, I've seen javascript (and written some too) to show the contents of input tags (useful if the guy before you left a password in an input...), but I want to use JS to show the Javascript variables that exist in the page. The reason I want to do this is because I want to check out a file sharing site to see if it's real or just a roo...

Why did one of my effects stopped working after adding another effect?

I am new to all of this so sorry if this is a stupid question. I had previously created a lightbox affect for my contact form and had it working great. Clicked contact, lightbox popped up with the contact form that kept in a separate html page. The script references were as follows: <link rel="stylesheet" type="text/css" href="css/lig...

create session with jquery?

is it possible to create session variables with jquery or javascript or do i have to use ajax to call a php that does that? ...

Find the class of the clicked item using Jquery

Hiya, I have the following code: $(".perf-row").click(function(e) { if (e.target.tagName.toLowerCase() == "a") { pageTracker._trackPageview($(this).attr("rel")); return true; //link clicked } else { window.open($(this).attr("rel"));return false; } }); to the conditional statment of if (e.target.tagName.toLowerCase() ...

Why javascript editors use iframe to implement?

Why do they prefer using iframe and turn on design mode by .contentWindow.document.designMode = "on" instead of directly using textarea? ...

why "$(opener.document).ready()" is not working?

I tried something like, below in popup-window, but not working... any correction at line 3, please suggest. function closePopup() { window.opener.history.go(0); $(opener.document).ready(function(){ window.opener.some_function(some_variable); self.close(); }); } ...

How to check JRE version in safari using java script

Hi I found lots of help for a javascript function which will check JRE version . It worked fine in Internet Explorer. But I am using Mac Operating system and I have Safari. The same examples did not work fine for Safari. The following link tells about javascript function which will check JRE version http://stackoverflow.com/questions/1...

Why does javascript turn array indexes into strings when iterating?

This Javascript logic puzzles me. I'm creating an array and setting the first element of it to a number. When I interate through it using a "for" loop Javascript turns the array key into a string. Why? I want it to stay a number. stuff = []; stuff[0] = 3; for(var x in stuff) { alert(typeof x); } ...

Slideshow in Javascript without framework, animation?

The issue I am having is fairly complicated to explain. I have written up a javascript that displays an image slideshow, and it works fairly well, despite using up more resources than I would like // imgArr[] is populated before var i = 0; var pageLoaded = 0; window.onload = function() {pageLoaded = 1;} function loaded(i,f) { if (...

Loading XML into Document object in Google Chrome

I am unable to load an XML file into a JavaScript Document in Google Chrome with the following function: // load XML document based on whether the browser is IE or other browsers function loadXMLDocument(url) { var doc; if (window.ActiveXObject) // IE { doc = new ActiveXObject("Msxml2.DOMDocument.6.0"); doc.async ...

Stop or interrupt php script for particular time

Can I Stop or interrupt PHP script for particular time? I would like to implement logic like below: on mydomain.com/index.php there will be flash appear showing some intro of a product for suppose 20 sec. Once it complete, on same index.php page the home page of site will appear. I am not aware about flash (action script). Is it poss...