javascript

Adding extra CSS with javascript

There's this image on a page I'm coding which should be resized and horizontally and vertically centered depending on some variables. I can't use the CSS sheet for this, as the width and height variables are dynamic. Therefore I want to have javascript add two extra arguments (top and left) to the style of this specific image. I've trie...

How do I refresh the browser every X seconds with javascript?

I use a Firefox plugin that can refresh the browser window every X seconds. As a frontend developer this is really useful as I can get instant feedback on CSS / XHTML changes the moment I save them in my editor. I've noticed, however, that this often stops working. I'm guessing this may be due to javascript/jQuery that I've added to the...

Generate javascript embed code for users

Hello, I have been trying to figure out how I can generate a piece of javascript code that will allow site users to copy and paste it into their own sites, much like google Adsense and there embed code: <– Begin Google Adsense code –> <script type=”text/javascript”> google_ad_client = “ad-client-code-goes-here”; google_ad_slot = “ad-slo...

How to wait for a Java applet to finish loading on Safari?

Hi, This doesn't work in Safari: <html> <body> <applet id="MyApplet" code="MyAppletClass" archive="MyApplet.jar"> <script type="text/javascript"> alert(document.getElementById('MyApplet').myMethod); </script> </body> </html> myMethod is a public method declared in MyAppletClass. When I first load the page in Safari, it shows the ...

How to detect if javascript files are loaded.

Is there a event that fires when javascript files are loaded. The problem occured because YSlow recoment to move javascript files in bottom of the page. This means that $(document).ready(function1) is fired before js file that contains code of function1 event is loaded. How to avoid this kind of situation? ...

YUI Autocomplete: search after pasting?

I'm using an auto-complete widget from YUI to implement live search as in the examples. However, it works fine when search text is typed in, but fails to work when the text is pasted into the field. Which would be the proper way to initiate an autocompletion on paste? Haven't found anything for that in the documentation... EDIT: Pasting...

innerHTML replace does not reflect

Hi I have HTML something like this <div id="foo"> <select> <option> one </option> </select> </div> when I use document.getElementById('foo').innerHTML = document.getElementById('foo').innerHTML.replace("<option> one </option>", "<option> two </option>") ; The innerHTML get replaced but it does not get reflected in the browser. ...

Adding checkboxes to an unordered list using jQuery

What would be the jQuery code to add a checkbox to every <li> element in an unordered list and handle their callbacks obtaining the li text or checkbox properties like name/value? I started with something like this: $(document).ready(function() { $("#SuperTextbox1_Results").children('li').each(function() { $(this).prepend('<in...

ESRI frameworks: java vs javascript

I'm about to develop a web mapping application with ESRI Products like ArcGIS Server and Image Server. I can't find a good comparison between the Java Web ADF and the Javascript Framework. They're of course different because one is a full environment and the other is only client side but it's much more concise and the step to start is m...

Randomize value in Javascript

I need to randomize set of values in JS, and I call function randomize for example three times. How can I remember and block random generator from giving me results that it gave me previous times? I can only give one value once. var value = Math.floor(Math.random() * 11); ...

Change Parent Window onclick Value From Child Window Via JavaScript

Setup: I'm opening a new window via js that is a classic asp page with one form (yes, classic asp, I know). That form posts to a processing page where I Response.Write() some inline js to manipulate form elements on the parent page like so. .Write ("<script language=""javascript"">" & vbcrlf) .Write ("var stopButton = opener.docum...

Create server control like panel and linklabel using javascript.

I want to add panel control using javascript inside the TD element. Is it possible to create these control using Document.createElement and appendChild methods? I also want to show and hide this panel control onmouseover and onmouseout event. ...

javascript with() function

is this part of the native javascript lib? which browser support it? ...

Catching events from Iframe in Firefox

This should subscribe function "handler" on scroll events from every iframe on the page var iframes = document.getElementsByTagName("iframe"); for (i = 0; i < iframes.length; i++) { var current = getRealObject(iframes[i]) current.contentDocument.addEventListener('DOMMouseScroll', handler, false) } function getRealObject(objec...

Is there a simple JavaScript way to manipulate arbitrary URLs?

Is there a way to easily handle manipulating URLs in JavaScript? A bit of context: I want to use ThickBox, the popular jQuery modal popup box, but unobtrusively. According to the ThickBox documentation I have to give all links that I want to be made modal a CSS class of "thickbox" and change the URL from... http://www.mysite.com/mypop...

Wordpress 2.8+ and IE8 display problems?

EDIT: Corrected the site header IE7 code in my original post. Have tried that and inserting X-UA-Compatible: IE=EmulateIE7 into the header without any success. Both of these steps are suggested by Microsoft here: http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx I'm working on a Wordpress blog (URL: www.nxtbot...

ajax request that returns json array, IE6/7 is caching it and data is not fresh

Hi, for some reason, IE6/7 is caching the ajax call that returns a json result set back. My page makes the call, and returns a json result which I then inject into the page. How can I force IE6/7 to make this call and not use a cached return value? ...

javascript in address bar

Question 1 step 1: i go to http://www.bloganything.net/731/cool-javascript-tricks-for-internet-browsers step 2: on the address bar, i delete step 1 url, and enter javascript:document.getElementById('rsidebar').value='dsf' ; the whole part refresh . how to prevent page from refresh when executing javascript on address bar Question2 ...

Automatic multi-page multi-column flowing text with QtWebkit (HTML/CSS/JS -> PDF)

I have some HTML documents that are converted to PDF, using software that renders using QtWebkit (not sure which version). Currently, the documents have specific tags to split into columns and pages - so whenever the wording changes, it is a manual time-consuming process to move these tags so that the columns and pages fit. Can anyone ...

Facebook app iframe + JS Facebook.init + IE7 + Flash9 sandbox error

During facebook iframe application integration I ask for publish permissions - I have HTML which loads JS Connect library and asks for permission dialog.. FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("_MY_API_KEY", "MY_PATH/xd_receiver.htm"); FB.Connect.showPermissionDialog('publish_stream'); However in I...