javascript

reinitialize dom events after ajax calls

Hi all, I have the following problem/doubt that I hope somebody could help me with. Let's say I have several javascript events being initialized when I load a page. In this page I allow the User to click on several action buttons (which have those events). Now, one of these buttons makes in this case an ajax call in which a successful re...

AJAX code not able to call a .php file.

I am not able to call a file: "fillDropDown.php". Why this code is not working? function MakeRequest() { var xmlHttp = getXMLHttp(); try { xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { HandleResponse(xmlHttp.responseText); } } xmlHttp.open("GET", "filldropdown.php",...

How to change a class based on the date using jQuery

Hi, I'm creating an advent calendar and I need a piece of jQuery/Javascript that will change the class on a div based on the date. I need all previous days to have one class, the present day one class and future dates one class. This is my source code: <div id="container"> <div class="box nov28">...</div> <div class="box dec1">....

Can we create onclick popup without Javascript in CSS?

Can we create onclick popup without Javascript in CSS? ...

jQuery attach function to 'load' event of an element

Hi, I want to attach a function to a jQuery element that fires whenever the element is added to the page. I've tried the following, but it didn't work: var el = jQuery('<h1>HI HI HI</H1>'); el.one('load', function(e) { window.alert('loaded'); }); jQuery('body').append(el); What I really want to do is to guarantee that anoth...

Is there a difference between using "this" and "prototype" in Javascript here?

Hi, Is there a difference between the two codes below, I presume not. function Agent(bIsSecret) { if(bIsSecret) this.isSecret=true; this.isActive = true; this.isMale = false; } and function Agent(bIsSecret) { if(bIsSecret) this.isSecret=true; } Agent.prototype.isActive = true; Agent.prototype.isMale =...

livequery for detecting dom changes

How do I detect the changes in DOM like innerHTML updated etc using JQuery's livequery. I tried like below Script - var matched = function() { alert('detected'); }; var unmatched = function() { alert('removed') }; $('div#container').livequery(matched, unmatched) HTML - <BODY onload="setTimeout(function(){ document.g...

show div onchange of dropdownlist value using javascript

i have a dropdownlist and i want to show a div ochange event using javascript but it says object required aspx code <asp:DropDownList runat="server" ID="lstFilePrefix1" onchange="showTR();" > <asp:ListItem Text="Prefix1" Value="Prefix1" /> <asp:ListItem Text="Prefix2" Value="Prefi...

Can't add new lines in JavaScript alert Box?

I'm generating a string in PHP and then eventually passing this string into a Javascript alert box, my problem is I actually can't add line breaks in my alert box. My code looks as follows $str = "This is a string\n"; $alert = $str."This is the second line"; if(!empty($alert)){ ?> <script type="text/...

a basic javascript class and instance using jquery "$(this)" for XML parser

I am (slowly) writing an XML parser for some "site definition" files that will drive a website. Many of the elements will be parsed in the same manner and I won't necessarily need to keep the values for each. The XML The parser so far My question is actually pretty simple: How can I use jquery manipulators in an class function? How ca...

javascript object expect error on IE8

I've checked this link, but I do want to know what if I don't update jquery version to 1.3 (current 1.2.6) and change my js code, which part of my code should be changed? var cnt=($("input[name*='cntidd']").size())-1; var in_id=$("input[name*='iId']").eq(cnt).val(); var fee=$('#total').val(); $("input[id*='item_no]").each(function (i...

Dynamicaly Chaning the <textarea > size,style

How can i change the field size diynamicaly? I have a select field and there are 3 options with different values. So if the user selects one of them in the you see the values. But how can i change the size that the values from option field fits in the function changeText() { var select = document.get...

Get all css styles for a DOM element (a la Firebug)

Hi, For a DOM element, how to I get all styles specified in css for a particular element? Is it a case of iterating over all css style names? Or is there a more elegant way? How does Firebug do it? Thanks ...

Is there an arraylist in Javascript?

I have a bunch of things I want to add into an array, and I don't know what the size of the array will be beforehand. Can I do something similar to the c# arraylist in javascript, and do myArray.Add(object); repeatedly on it? ...

eval id via radiobutton inside datalist using javascript

i gt a radio button inside my datalist through which i am evaluating id in hiddenfield like this <ItemTemplate> <table cellpadding = "1px" cellspacing = "0" class="dlTable"> <tr> <td align="center" style="padding:15px"> <a href="<%#Eval("FilePath")%>" target="_blank"><asp...

Javascript Inline Events or Adding Events Afterwards

Hello, I have a question, which I can't seem to decide on my own so I'll ask here. The question is simple: whether use inline Javascript events or adding them afterward. The theory in the background isn't that simple though: I have a JS object that returns HTML. Whenever you create this object, the returned HTML will be used for anothe...

jquery animation not showing up

$('#main-mission .fade').animate({opacity:1.0;filter:alpha(opacity=100);}, { queue:true, duration:2000 }).animate({opacity:1.0;filter:alpha(opacity=100);}, 1500).animate({opacity:0.0;filter:alpha(opacity=0);}, 800,'linear',function(){ $('#main-mission .fade').html("<font size='3'>... to organize and display the data that people need, to ...

Cross frame Javascript - frames loaded from local (file://)

I have two frames loaded from local filesystem with file:// URL. How can I access the document in the left frame from the right frame? parent.leftFrame.document gives: "Error: Permission denied to get property Window.document" I went through several articles explaining Same origin policy for JavaScript but those didn't help with files ...

JavaScript innerchild?

I have the following example HTML: <div id="target"> <div id="targetText"></div> </div> and I'm using the following code to get the inner div: $('#targetText'); instead, I was wondering if I could drop the id of the inner element, and somehow match the #target's child? I have like hundreds of inner children, so, it does not make s...

Get values from multiple selections in SELECT

Hello. I have a selection box that allows you to select multiple options. I need to access all the selected values with JavaScript - possible a array of values? Thank you :-) ...