| | |
submit once button
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<form> <input type="submit" disabled="disabled"> </form>
> I worked with ajax, I can do this with a submit button, but when I i
> put the form tag, not work any more.
It worked because Ajax doesn't depend on a FORM element for shipping data to and fro; it uses the
Also, doesn't work is a pretty useless description, we need more description or a sample snippet which showcases the problem at hand.
> put the form tag, not work any more.
It worked because Ajax doesn't depend on a FORM element for shipping data to and fro; it uses the
XMLHttpRequest object for this purpose.Also, doesn't work is a pretty useless description, we need more description or a sample snippet which showcases the problem at hand.
I don't accept change; I don't deserve to live.
dont know how much you know about javascript but this will do the thing that you want.
this one adds butons into body onclick event and changes its label to delete and
delete buton delete any other button randomly (doesnt remove itself)
this was an interview question
object model used to support ie4+
replace document.body.removeChild(btns[tmp]); and add there what you want and it will work.
this one adds butons into body onclick event and changes its label to delete and
delete buton delete any other button randomly (doesnt remove itself)
this was an interview question
object model used to support ie4+
replace document.body.removeChild(btns[tmp]); and add there what you want and it will work.
javascript Syntax (Toggle Plain Text)
var q = q ? q : new Object(); /* create document element */ q.CreateElement = function(tagName) { return document.createElement(tagName); }; /* set element attribute */ q.SetAttribute = function(element, attName, attValue) { return element.setAttribute(attName, attValue); }; /* append element to given parent */ q.AppendChild = function(parent, newChild) { return parent.appendChild(newChild); }; /* set element class name */ q.ClassName = function(element, className) { return element.className = className; }; /* fetch source element of the event */ q.GetTarget = function(ev) { var target; if (!ev) var ev = window.event; if (ev.target) target = ev.target; else if (ev.srcElement) target = ev.srcElement; if (target.nodeType == 3) target = target.parentNode; return target; }; /* button click event */ q.buttonClick = function(event) { /* as we cannot pass parameter with the event (possible in IE Browsers), checking the value of source element. */ if (q.GetTarget(event).value.indexOf("Add") == 0) { var newBtn = q.CreateElement("input"); q.SetAttribute(newBtn, "value", "Delete"); q.SetAttribute(newBtn, "type", "button"); /* set type of the input */ /* attach event to new button */ if (newBtn.addEventListener) { /* if FF */ newBtn.addEventListener('click', q.buttonClick, event); } else { /* if IE */ newBtn.attachEvent('onclick', q.buttonClick); } q.ClassName(newBtn, "q"); q.AppendChild(document.body, newBtn); } else { var btns = document.getElementsByTagName("INPUT"); var tmp; /* temporary value */ while (tmp = Math.floor(Math.random() * 10)) { if (tmp < btns.length) /* boosting */ { /* check if the button has no values as "Add" and not the sender itself, remove it */ if (btns[tmp].value.indexOf("Add") != 0 && btns[tmp] != q.GetTarget(event)) { document.body.removeChild(btns[tmp]); break; /* end the loop */ } } } } };
Last edited by fatihpiristine; Jan 13th, 2009 at 7:55 pm.
Do a favour, leave me alone
![]() |
Similar Threads
- submit button code (Perl)
- how to set the multiple submit button in asp (ASP)
- submit button (JSP)
- VB6 submit button sends information to BBChat (Visual Basic 4 / 5 / 6)
- Submit Button Help (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Are graphically connected nodes possible, and can they be altered by input?
- Next Thread: Refresh the page to all in the site on click
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal pdf php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n






