javascript

How to solve Microsoft JScript runtime error: 'length' is null or not an object?

Hi all, I am using the following flat calendar control to populate my textboxes with date. http://www.dynarch.com/static/jscalendar-1.0/simple-1.html. I am using the validator controls for the textboxes to which i specified the calendar control. The two textboxes are used to enter the start date and end date. I have used the regex,com...

Why does removeChild need a parent node?

After answering this question I am left wondering why removeChild needs a parent element. After all, we could simply do node.parentNode.removeChild(node); As the parent node should be always directly available to the Javascript/DOM engine, it is not strictly necessary to supply the parent node of the node that is to be removed. Of co...

Escaping quotations for jQuery XML request

Simple question really, I am relatively new to both jQuery and XML. I just want to pull an email address into a link, but unsure how I am escaping the quotations. <a href="mailto:'+email+'">Email me</a> The +email+ is being taken from an XML file with code like this: <email>[email protected]</email> so I want the HTML to look like: <a...

How do you document your JavaScript?

Hi, I need to document quite a lot of JavaScript and jQuery code. I'm interested in diagrams, rather than the written documentation. I'm wondering if there is some sort of standard for modelling the JavaScript functions? My goal is to show visualy how different functions interact with each other. Thank you Edit: I have been trying D...

Unpacking array into separate variables in JavaScript

This is a simple problem, and I've done it before. I just can't remember how, or what exactly it was called. In python I can do this: arr = ['one', 'two'] one, two = arr how do I do that in JavaScript? ...

How to calculate the offset() of an <li> relative to its parent container

I have a <li> which is nested inside a containing <ul>, what I would like is to calculate the offset. But have the top-left corner of the <ul> be 0, 0. So my HTML is: <div style="margin: 0 auto; width: 760px; height: 760px; overflow: hidden;"> <ul style="width: 2000px; height: 2000px; min-height: 2000px; position: relative;"> ...

Sharepoint - display bug in javascript edited newform.aspx ( wss 3.0 )

hi there o/ I took the generated newform.aspx file that has a select-field with 3 options. I now added some js/jquery code to display different fields for options 1/2/3 by taking the internal field name of the select-field and looking up what option is selected and change the displayed fields. That worked perfect for a while for intra...

problem with onBlur event in IE

I have this HTML: <textarea class="question" onBlur="onBlurFun(event); return true;" name="aaa" id="bbb"></textarea> And this function in JavaScript onBlurFun = function(event) { var tgt = $(event.target); alert(tgt.attr('id')); } In IE, tgt is not properly set. What should I do to have access to calling node? ...

trying to load second request causing problem ?

Hi i am getting the error of Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead [Break on this error] Failed to load source for: http://www.xyz.com/# i am loading external page in div using ajax call while first page its not causing any problem but when i load second one its ...

How do I pass function parameters into a regex query?

How would I go about passing function parameters into a regex query? Many thanks. function match(str, arg1, arg2){ var result = str.match(/(arg1 | arg2)/m); log(result) //null } match('claire nick steve', 'nick','steve'); ...

How not to load all images on a page on load

I have a page with a list of jpg images on the page. The div that contains images is hidden and works as images source for Galleria jQuery image gallery plugin. So, when I load a page, it takes long to load it because it loads all images. Is there a way not to load all these images on page load, but just when galleria needs them? ...

Javascript Prototype .visible() method not working in Internet Explorer

I'm using the Prototype (and script.aculo.us) javascript library - since it's what comes with Rails "as standard" - and having a problem with the following snippet: function show_hide_selects() { chkbox = document.getElementById('game_random_select') seldiv = document.getElementById('card_selects') if (chkbox.checked && seldiv.vi...

i want a delay of 100millisec while running each loop

for(i=100;i>=0;i--){ icon.style.filter="alpha(opacity=0)"; } this is my for loop ... wat i want is tat each time for loop completes 1 loop it should wait or sleep for 100millisec so tat it can give a fadding effect.... ...

Specifying a callback in jQuery.ajax to OpenCalais SemanticProxy service

Hi all, I'm trying to query the OpenCalais service semanticproxy.com. Unfortunately, their url format is as follows: http://service.semanticproxy.com/processurl/APIKEY/jsonp:handler_function/http://en.wikipedia.org/wiki/Germany notice that the function callback, is not in a callback=? parameter, but rather follows the response format...

jquery remove all child elements and leave text

Whats the best way to remove all child elements from a div but leave any text that is directly inside the div in jquery. I have tried .childre().remove() but this is adding loads of whitespace in firefox and opera. Works fine in ie though. ...

I.E css position problem when scrolling

Hi Everyone, I have written a scrollSpy function that detects user activity as they scroll up and down on a webpage. <script type="text/javascript"> function yPos() { var pos = 0; if( typeof( window.pageYOffset ) == 'number' ){ //Netscape compliant pos = window.pageYOffset; } else if( document.body && ( document.body.scr...

PHP and AJAX, sending new PHP info to page for AJAX to receive, is this possible?

I'm searching on how to do this but my searches aren't turning up things that are talking about what I'm trying to do so maybe I'm not searching with the right terms or this isn't possible, but figured I would ask here for help.. this is what I am trying to do.. I have PHP scripts that are called asyncrhonously, so it is called and it j...

ToolTip text as selected value in ASP.Net dropdown

Hi, I have ASP.net Dropdown.The dropdown is too small to display full text the user selected. So i decided to show tooltip.In tooltip i need to display currently selected Text. ApplyToDropDown.Attributes.Add("onMouseOver", "ShowApplyToText()"); function ShowApplyToText() { var ApplyToDropDown = document.getElementById("ApplyToDrop...

Adding divs to the HTML body using Lift

I have been playing around with Scala/Lift/Comet/Ajax etc. recently. I came across a problem which boils down to this: Summary I want to update a specific div (by id) when a certain event occurs. If the div does not exist yet, it must be created and appended to the HTML body. Currently I cannot get this to work when using the Lift fra...

jQuery z-index doesn't work

Hi, i have a menu and on hover i fade a box in. Behind this box i have a small icon and i want to move it in front of the box so you can see it on hover. Here is my menu > Navigation I tried it with that jQuery(this).find(".flyer").css("z-index", 10000); but it stays behind. How could i manage that problem? greets Max ...