| | |
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 |
acid2 ajax ajaxexample ajaxjspservlets array beta box browser captchaformproblem cart checkbox child close codes column css date debugger decimal dependent design disablefirebug dom download editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming prototype redirect runtime safari scale scriptlets scroll search security select shopping size software unicode w3c web window windowofwords wysiwyg \n






