javascript

How do I embed a flash SWF file and get around the IE security layer without using swfobject (to keep down file size)

I'm looking for a way to embed an SWF into a page and get around the Internet Explorer security issue (where it requires an extra click to "activate" the flash file). I've got my code working with swfobject, but I'm using this in an embedded widget context (eg a clickable banner ad) so I am really trying to keep my file size down, and ...

How to stop reloading Java applet when changing "overflow" style

When I change the "overflow" style on document.body from "hidden" to "auto", it forces a reload of a Java applet that is on the page. I have set overflow to hidden because most of the time I don't want scrollbars to be visible on the page, but I'd like to enable them without losing state in my applet. Is this possible, or is there ano...

Looking for an Ajax or PHP trick to detect if they have Javascript...

I am looking for some kind of trick to determine if a user has javascript... I figure I could do it somehow by sending a ajax request at the top of a page, and in that ajax request, set a session variable, and then somehow reload the page, and see of it was set... Is there any tricks like this around in PHP/AJAX? ...

Is there a framework for defining parsers in JavaScript?

Is there a JavaScript framework that allows to define a parsing grammar using JavaScript syntax, similar to the way Irony does it for C#? ...

Inconsistent jQuery function when resizing elements on page load

Ahoy! I've built a little script to check the size of the left-hand margin on page load, resize a div there to fill it, and change the header div to float next to it. Here's the code: function buildHeader() { var containerMarginLeft = $(".container_16:not(:first)").css("margin-left"); var headerHeight = $("#head...

Form not submitting with JS

I have the worlds most simple javascript function: fnSubmit() { window.print(); document.formname.submit(); } Which is called by: <button type="button" id="submit" onclick="fnSubmit()">Submit</button> All is well and good, the print dialog shows up, however after printing or canceling the print I get the following error: "docu...

How to merge jquery autocomplete and fcbkListSelection functionality?

Initial caveat: I am a newbie to jquery and javascript. I started using the autocomplete jquery plugin recently from bassistance.de. Yesterday, I found the fcbkListSelection plugin (http://www.emposha.com/javascript/fcbklistselection-like-facebook-friends-selector.html) and am using it to include a selector in my application. What I n...

cycling through background colors with javascript

Can anyone tell me why the following code might not cycle through the array of colors defined here: var colors = ["white", "yellow", "orange", "red"]; and here is the line of code in question: setInterval(function(){ currElm.style.background = colors[(nextColor++)%(colors.length)]); }, 500); It seems like that shoul...

How do I get the contents of an <iframe> containing a different site?

I'm able to get the 'src' attribute of an using .src. But I cannot get the contents that are located in another domain. Is this a browser security problem? jQuery(document).ready(function() { var elementTest = $("iframe:first").get(0); alert(elementTest.src); // ok alert(elementTest.innerHTML); // not ok }); ...

Chrome Javascript Double Alert Loop?

Thi simple code below outputs two alerts instead of one Google Chrome browser. Can you tell why only in Chrome? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/h...

How do you change a div with another div, onmouseover?

I have the following code <div class="item" id="item1">Text Goes Here</div> <div class="admin_tools" id="tools1">Link 1 | Link 2 | Link 3</div> <div class="item" id="item2">Text Goes Here</div> <div class="admin_tools" id="tools2">Link 1 | Link 2 | Link 3</div> *admin_tools* div is hidden from view by default. When a mouse is moved o...

Errors using yuicompressor

Hi, I am getting some errors when trying to run yuicompressor. it says: [error] 1:2:illegal character [error] 1:2:syntax error [error] 1:3 illegal character Could this be because I am saving it as the wrong encoding or something? update first few lines of my code function page_init() { $().ready( function() { ...

How do I wrap a page element with a dynamically generated element using jQuery?

I have the following code var input = $('#el_id'); wrapper = $(document.createElement('div')); wrapper.addClass('small'); wrapper.css('width',200); input.wrap(wrapper); alert(input.children().length) I get 0 for the children length. What I want is: <div class="small" style="width: 200px;"> <input type="text" id="el_id" /> </di...

Date of Birth selector problem in IE6

I'm using a javascript date selector within a HTML form, and it's displaying as it should in the browsers I've tested in (Firefox 3, Opera 9, Chrome, IE7) but it displays really large in IE6. Here's the page I'm talking about - http://marketplace.prettypollution.com/kids-club Any ideas? ...

Serialize Entity Framework Object using Json.Net

Hi, How do I serialize entity framework object into JavaScript Object (JSON)? I tried using JSON.NET but I am getting the following exception when I try to serialize it. Exception: Newtonsoft.Json.JsonSerializationException, Message="Self referencing loop" Hitesh ...

JScript Error Message

<asp:TextBox ID="txtOriginalNo" runat="server" onkeyup="javascript:if (event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('ibtnSubmit').click();}};" onKeyDown="return AlphaNumeric(event)" TabIn...

Whats the best way to audit changes on a particular form field??

I need to add an entry into a database everytime a field changes in a form indicating the old value and the new value. How would you go about this?? Would you... Add a hidden field for every field and compare it to the new value on submit then add an audit entry if neccessary?? Do a select of the data to be inserted on post then comp...

Efficient way to find a string between two other strings via Javascript

Hey folks, This ought to be pretty simple, maybe use a regex but I would think there is an easier - faster way. Currently I make this work by using a couple of splits, but that sure seems like a poor method. Example string: on Jun 09, 2009. Tagged: What I need to do is turn that date (June 09, 2009) into three strings (Jun, 09, ...

How do you obtain the anchor part of a URL in JavaScript?

How to obtain anchor part of URL after # in JavaScript? This is related with http://stackoverflow.com/questions/1032242/php-question ...

Which behavior to expect from jQuery find()?

Here's a Firebug session >>> var e = $("<div>div-1<p>p-1</p></div><div>div-2</div><p>p-2</p>"); >>> e [div, div, p] >>> e.find('div') [] >>> e.find('p') [p] Isn't e.find('div') and e.find('p') supposed to return [div, div] and [p, p] respectively? ...