javascript

Add onclick property to input with JavaScript

I am creating a user input at one of the events: var throwConnectBox = function() { chat_box = document.getElementById('box'); div = window.parent.document.createElement('div'); input = window.parent.document.createElement('input'); input.type = "submit"; input.value = "Join chat"; input.onclick = "conn.send('$co...

Better PHP,MySql,HTML and JavaScript IDE

Hello guys, I am currently using the below IDE's. They serve their purposes but am wondering if there are better ones out there that i can switch to. phpDesigner v6.2.5 (For PHP) Navicat 8.0.29 (For MySql) Dreamweaver CS3 (For HTML & CSS) Spket IDE (For JavaScript) Thats my collection of production tools. Wondering if there is anyone ...

How might I implement immediate text submission when the enter key is pressed in a textarea?

Duplicate: Submitting data from textarea by hitting “Enter”. I've got a textarea and a submit button: <textarea id="chat"></textarea> <input type="submit" value="Submit" onclick="send_msg();"> The value of the of the texarea is submitted when Enter is hit: textarea.onkeyup = function(e) { alert(e.keyCode); ...

How to create and use a XML document object properly considering browser compatibility?

Now I'm working on a web project. I need to create a XML document object using a given string buffer in JavaScript. I've successfully made it run smoothly on IE, but apparently I need to do some more work to improve its compatibility. To help you understand my poor English, here is a tiny example describing what I want to express (Note,...

need to get value from the database and populate a drop down list using jquery

hi i need to populate a drop down list when i select a certain value , and the options need to be queried from the database .. can i achieve this from jquery ? if i can then please i would appreciate any help.. ...

Is it possible to use muliple AJAX libraries on one page?

Hi, I am just curious. There are many ready-to-use AJAX libraries out there like Mootools, Scriptaculuos, Prototype, YUI etc My question is, is it possible to combine them? If I download all the code and put them on the same page, will it cause errors? Which open source AJAX library would you recommend for a beginner? ...

Variable scope in Javascript for loop

What's the difference between: function bar() { for (x=0; x< 100; x++) {} } And function bar() { var x; for (x=0; x< 100; x++) {} } If x wasn't declared outside of that function, and so it wasn't a global variable? I always wonder this because I generally don't declare throwaway variables which are used only in a loop, but I ...

Using checkboxes with ASP.NET and Javascript

I have Javascript code that does this: var oObjchbox = document.getElementById("CheckBox_" + countyId); The countyId comes from an image map that is pre-made. The checkboxes on the other hand are created by ASP.NET. My first try was to use an asp.repeater with asp:checkBox, but that did not do the trick since ASP.NET insists on crea...

Onsubmit form validation function not working in IE

Hi all, Im working on a simple javascript validation function for a html form, but have run into issues with it using IE7. I dont get any error messages, the form simply submits without validating. Firefox, and Opera work fine, so Im really not sure what i am doing wrong here. Ive googled around, but not found anything helpful, or maybe...

missing ] after element list parsing JSON

Executing that: $.post( "/url/to/method", { }, function(data){ var obj2 = eval("("+$(data).children()+")"); // OR var obj = $.evalJSON($($(data).children())); // Jquery-json $body = $("#AAA"); $body.html(obj.fied); }, "xml" ); while turn into a "missing ] after element list" (at row 5 or 6) error in firebug. The JSON ...

Pseudo-classical vs. "The JavaScript way"

Just finished reading Crockford's "JavaScript: The Good Parts" and I have a question concerning his stance on the psuedo-classical vs. prototypal approaches. Actually I'm not really interested in his stance; I just want to understand his argument so I can establish a stance of my own. In the book, Crockford seems to infer that construct...

Somewhat lost with jquery + php + json

I am starting to use the jquery $.ajax() but I can't get back what I want to...I send this: $(function(){ $.ajax({ url: "graph_data.php", type: "POST", data: "casi=56&nada=48&nuevo=98&perfecto=100&vales=50&apenas=70&yeah=60", dataType: "json", error: function (xhr, desc, exceptionobj) { ...

How to get value of textboxes, textareas, and radios in the same way in Javascript?

I want a function/code which will return the value that the user submitted for the field whose name/id is passed on to it. It shouldn't matter whether the field is a textbox, textarea, radio, or select. For example, the field could be: <input type='radio' name='a_21' value='test' id='a_21_0' /> <input type='radio' name='a_21' value='tes...

How can I bind events to the appended element?

I tried to show an error message using the jquery effect fadeTo and tried to hide the message by appending a button and using fadeout but doesn't seem to work. What I did was: $("#sub_error") .fadeTo(200, 0.1, function() { $("#sub_error") .html(error.join("<br/><br/>")) .append('<br/><input type="button" name="err_o...

Unable to make a SO floating effect for browsing messages in jQuery

I am interested in the floating effect of SO when pressing the newest link: Which library would you use in jQuery to make the floating effect? ...

How can I execute javascript in Bash?

I try to get to a page straight from Bash at http://www.ocwconsortium.org/. The page appears when you write mathematics to the field at the top right corner. I tested open http://www.ocwconsortium.org/#mathematics but it leads to the main page. It is clearly some javascript thing. How can I get the results straight from Bash on th...

Is there a way for a JavaScript file to load another file in AIR?

I've been trying to build my own (small) framework in JavaScript for an AIR application and I've run into a peculiar problem: I can't find a way for a JavaScript file to load another. It seems the only way to load JavaScript is for an HTML file to load it. Is this correct? Is there really no way for a JavaScript file to load another? ...

Passing associative array through AJAX to PHP

I'm trying to pass this to a PHP script through AJAX: var answers={}; for (x=0; x< allAnswers.length; x++) { answers.x=new Array(); answers.x['id']==allAnswers[x]['id']; answers.x['val']=$("#field_" + x).val(); } var data={}; data.id=questions[qId]['id']; data['answers']=answers; $.post('inde...

Is there a test suite for HTML/JavaScript canvas element?

I'm developing an alternate backend for the canvas interface. I started setting up test cases, and then it occurred to me that there may already by a set of tests, but google isn't forthcoming. ...

i tried serialize() but doesnt seem to work ? what am i doing wrong?

i did this but not working if(error.join()!="") { $("#sub_error").fadeTo(200,0.1,function() { $("#sub_error").html(error.join("<br/><br/>")).append('<br/> <input type="button" name="err_ok" id="err_ok" value="ok">') .addClass('subboxerror').fadeTo(900,1); bindEvents(); }); function bindEv...