javascript

JavaScript form code not working?

I have this form in my site that uses JavaScript to clear the fields when clicked on (highlighted) and also checks to see if all the fields have been filled in. I've used this code for other sites and it works fine. I can't figure out why it doesn't work now! Everything is the same from the previous code! ...

XMLHttpRequest object not being instantiated?

I'm new to Ajax and this has me stumped. It's relatively simple but trips up on the onclick handler with the first xhr.open(). Firebug says it's not a function, my guess is the XMLHttpRequest object isn't being created, but I'm not sure. Anyone have any ideas? Thanks in advance. function init(){ function getXMLHTTP(){ var xhr = fals...

Prevent form redirect OR refresh on submit?

Hey guys. I've searched through a bunch of pages, but can't find my problem, so I had to make a post. I have a form that has a submit button, and when submitted I want it to NOT refresh OR redirect. I just want jQuery to perform a function. Here's the form: <form id="contactForm"> <fieldset> <label for="Name">Name</label> <input...

How to parse an xml ajax reply with jQuery?

Using an ajax POST request in jQuery, I get the following xml back from the server: <?xml version="1.0"?> <data> <subject> <val1>...</val1> <val2>...</val2> <val3>...</val3> </subject> <subject> <val1>...</val1> <val2>...</val2> <val3>...</val3> </subject> ... </data> The xml will have an arbitra...

Modifying the DOM based on an AJAX result with jQuery

I'm unsure of the best practice for modifying the DOM based on an ajax response. I'll try to let the code do the talking because it's hard to explain. // page has multiple checkboxes $("input[type='checkbox']").live('click', function { var cb = $(this); // for the sake of discussion i need this variable to be in scope $("form").ajax...

When is an object in Javascript constructed?

Consider the following Javascript function (1): function setData(domElement) { domElement.myDataProperty = { 'suppose': 'this', 'object': 'is', 'static': 'and', 'pretty': 'big' }; }; Now what I don't like about this function is that the exact same object is created every time the function is called. Since the objec...

Can you have multiple log in buttons for Google Friend Connect?

I was wondering if it's possible to have multiple log in buttons for Google Friend Connect... google.friendconnect.renderSignInButton({id:"google-login",style:'long'}) That code renders the log in button. Unfortunately it accepts an id, and id's have to be unique. Is there any way to do something similar to google.friendconnect.rend...

Javascript Function Scope

This is perhaps a dumb question, but I am new to Javascript and desperate for help. If the Javascript engine will look for global variables outside of a function, then what is the point of passing parameters to it? What do you gain? I understand that global variables are generally frowned upon, but I still don't understand the purpose ...

Access array returned from a function - javascript/jquery noob moment

When the form is submitted, I'm calling a function getPosts and passing through a variable str. What I'd like to do is get the data returned from that function. // when the form is submitted $('form#getSome').submit(function(){ var str = $("form#getSome").serialize(); var something = getPosts(str); * This is where I'd like to g...

How to write JavaScript to interact with Flash

Now we are developing a Chat Engine which is based on JavaScript and Flash. But, what we get stuck with now is that we cannot find a good JavaScript library to talk with flash. Additionally, we use OpenFire as our Server. Anyone has a good solution to this problem? thanks for your help! ...

Is a variable in javascript available after loading an iframe and then going back to the page?

I am using a jquery plugin called colorbox, this might be irrelevent though as my colorbox just opens an iframe on screen. So more basic I guess is, I have 3 variables on my parent window that are returned from an AJAX call with jquery: data.response data.comment data.userid After these are set lower down in my script I call my ...

What does bind and unbind mean in jquery?

What does bind and unbind mean in jquery in idiot slow learner terms? ...

How to get iFrame src content using javascript?

I have a iFrame content which is having inside another iFrame. I want to get inside iFrame src content. how can i do this using javascript? ...

Javascript file pagination script

Hi everyone, I want a javascript for file navigation. For e.g.- I have a folder named 'content' in which there are 'n' no. of html files named like content_000.html, content_001.html to content_nnn.html. There should be buttons like next and previous, clicking on next button will traverse to next html file whereas previous button will...

Problem while i am trying to display the events in the calendar ?

Hell all, I am creating a event module. In that as usual after creating the event we need to display the event title in the popup when clicking the date in the calendar. its working. but if i have multiple events in the same day its just showing the first event. Template Engine i used here is SMARTY. And i used {literal} to differentia...

Question about Javascript (Jquery) and GET

After getting a new page with $.get none of the javascript will run on the new page. Is there a way to make javascript use the new page too? Many thanks Dorjan Edit: Example: $(function() { $('.viewPage').click(function() { $('#mainarticle').fadeOut('slow') $.get($(this).attr('href'), { js: "1" }, function(data) { ...

How to detect if an element is not visible in a fast way in JavaScript?

Hi! In the past we used the CSS attribute "display" to show and hide DOM elements. To check if an element is visible, we could just use: element.offsetWidth > 0 Since we had some problems with Flash and Java Applets (they stop when they get display:none) we switched to the CSS attribute "visibility". I am now looking for a fast and e...

JavaScript - ASP.net - Loop through all controls on an asp pannel.

Is there any way for me too loop though all controls on an asp.net pannel, and for each of the controls check the type to see if it is of asp type TimeInput? The JS basicly needs to replicate this serverside VB.net code 'this is checking that something has been entered into at least one of the time input boxes Protected Sub valCusAllT...

IntelliJ IDEA 8.1.3 's Js BUG?

In IntelliJ IDE 8.1.3 when I new a javascript file named verify.js I found that verify.js 's icon chaged to a dtd file and there isn't syntax highlighting (code-colors). When I use the other file name, things work all right, but why? Details[includes pic]: http://javazn.javaeye.com/blog/445858 ...

Programmatically stop Javascript execution in FireFox/FireBug

I am currently debugging complex Javascript/AJAX code written with mootools with FireBug. I am looking for a way to stop the JS execution as if it was a breakpoint programmatically. Ex: instructions ... degugger.breakpoint(); // the execution stops here as if a breakpoint was // manually set other instructions .....