javascript

Reading Iframe Content in Iframe Load

Hi, I just wanna learn how to read Iframe content in onLoad event of iframe and write it's content to the main page ? Thanks.. ...

How to get serverside information into javascript?

Hi, I don't know how to ask this question that's why I'm going to simulate what I need, some developers make what I need by rendering javascript with php. A simple sample file would look like: my_javascript_file.php <?php include "my_class.php"; ?> $(document).ready(function(){ $.ajax({ url: "<?php $my_obj->post_url(); ?>...

Javascript : Using Switch to set variables values for the function

Hello am totally new to Javascript , but i need it for using googlemaps in my project , am trying to set values for the latitude , longitude and map zoom for every certain city , so am getting the city name from a hidden form input and using Switch to switch regarding the city name . cityDiv = document.getElementById('id_city'); cityDi...

javascript regex replace html chars

I'm using javascript to set the value of an input with text that may contain html specific chars such a &amp; &nbsp; etc. So, I'm trying to find one regex that will match these values and replace them with the appropriate value ("&", " ") respectively, only I can't figure out the regex to do it. Here's what I'm trying to do. Make an o...

How can I erase all inline styles with javascript and leave only the styles specified in the css style sheet?

If I have the following in my html: <div style="height:300px; width:300px; background-color:#ffffff;"></div> And this in my css style sheet: div { width:100px; height:100px; background-color:#000000; } Is there any way, with javascript/jquery, to remove all of the inline styles and leave only the styles specified by the...

Is it faster access an javascript array directly?

I was reading an article: Optimizing JavaScript for Execution Speed And there is a section that says: Use this code: for (var i = 0; (p = document.getElementsByTagName("P")[i]); i++) Instead of: nl = document.getElementsByTagName("P"); for (var i = 0; i < nl.length; i++) { p = nl[i]; } for performance reasons. I always use...

problem using AJAX call in IE6 and IE7 -- I am asking the same question again, cause i did not get any solution before

I have this code, which is working fine in FireFox, chrome and IE8 but is it not working on IE6 and IE7. function GetXmlHttpObject() { //var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Mic...

JQuery Toggle Method Slow on 1000+ UL

Hello Everyone, I am working on a project where I am building a treeview and in some cases my tree could have a 1000+ child nodes. The problem is its really slow on like a IE7 machine. I'm not doing any kind of animation or anything, just simply trying to hide the next UL in the item using JQuery's toggle feature. Does anyone have an...

jQuery, how can I pass args to event handler?

How can I pass args to the event handler function? This runs the function on page load which is not the desired effect. I need this routine "validateText" to run against several different textbox, dropdown combinations. Can I reuse "validateText" instead of creating one per text/dropdown combination?? //add blur event handler to the te...

how to go through an array and add their values

I was wondering how is it possible to go through the values of an array and add their values together. var arr = [1,2,3,4]; should I use var add = $.each(arr,function() { }); but how can I add the values together. thanks ...

How can I rewrite the ErrorMessage for a CustomValidator control on the client?

I have a CustomValidator that is validating a telephone number for several different telephone numbering schemes. The client-side javascript looks like this: validatePhoneNumber(sender, args) { cleanNumber = args.Value.replace(/\D/, ""); country = $("#" + CountryID).get(0).value; switch (country) { case "North Americ...

How to see if an element in offscreen.

I have a list of divs, and everytime I want to go to the next div I press a key. I need to check if that div is offscreen, and if so, I need to move the screen to show that div either using anchors or another method. What is my best option for doing this? Just to clairify, offscreen in my case means something that can't be seen right n...

clone table row, append random or sequential number to ID

So i have this code $('input.clone').live('click', function(){ //put jquery this context into a var var $btn = $(this); //use .closest() to navigate from the buttno to the closest row and clone it var $clonedRow = $btn.closest('tr').clone(); //append the cloned row to end of the table //clean ids if you need to $cl...

Javascript Regex: How to bold specific words with regex?

Given a needle and a haystack... I want to put bold tags around the needle. So what regex expression would I use with replace()? I want SPACE to be the delimeter and I want the search to be case insensitive so say the needle is "cow" and the haystack is cows at www.cows.com, milk some COWS would turn into <b>cows</b> at www.cows.com...

how to reset a form after submit?

Hello all, I have a simple form, lets say it takes an email address. Once the form is submitted a message stack notifies the user that their address has been submitted successfully. The issue is that after submitting the address the form field with the email still contains the email address that the user typed in, how would I reset th...

Ext JS GroupingStore group DateTime column by just date?

I have an Ext GroupingStore on a list of orders. One of the columns is a DateTime. I would like the user to be able to group by the DateTime column and have all days under one group. At the moment, each date, hour, minute and second is one group... not very useful :-) Any way short of two columns to accomplish this? ...

javascript drop down menu and flash conflict

Hi - I've got a problem where the javascript drop down menu I've added to my html page either appears behind a flash image or it interferes with the thumb nails in my flash pic. The problem is different for different browsers and mac / PC. ...

Open Accordion When User Lands on Page

What is the needed JS needed to make the first Accordion container to be open, using this code: http://mibsolutionsllc.com/icontact/?page_id=7 ...

Graph drawing for the Web 2.0

Hi. There are a lot of chart drawing libraries out there, but what I am looking for is an interactive(!) graph (nodes and edges) drawing library. At best some kind of AJAX, but I am also open for other technologies (Java, Flash). However I would really prefer an AJAX implementation. Also only Open Source framework suggestions please (I ...

How to read pdb format by javascript?

I know that it is a databases in Palm OS, as the development is shift to webOS. Is there any third party javascript library to do the work? or it needs to write manually? ...