marcus Posted April 16, 2007 Share Posted April 16, 2007 <script type="text/javascript"> function insert(el,ins) { if (el.setSelectionRange){ el.value = el.value.substring(0,el.selectionStart) + ins + el.value.substring(el.selectionStart,el.selectionEnd) + el.value.substring(el.selectionEnd,el.value.length); } else if (document.selection && document.selection.createRange) { el.focus(); var range = document.selection.createRange(); range.text = ins + range.text; } } </script> <form> <input type="button" value="Quote This User" onclick="insert(this.form.reply,'[quote=username]their message[/quote]')"> <br /> <textarea rows="7" cols="30" name="reply"></textarea> Is what I'm trying to do, it make the input type="button" a normal a href="#" link, but act the same way as the input button. Link to comment https://forums.phpfreaks.com/topic/47173-making-a-text-link-act-the-same-as-a-form-button/ Share on other sites More sharing options...
Zeon Posted April 16, 2007 Share Posted April 16, 2007 never tried it, but this should work: <form id="someform"> [...] </form> <a href="#" onclick="submitform();return false;">submit form</a> function submitform(){ var form = document.getElementById('someform') form.submit() } Link to comment https://forums.phpfreaks.com/topic/47173-making-a-text-link-act-the-same-as-a-form-button/#findComment-230187 Share on other sites More sharing options...
marcus Posted April 16, 2007 Author Share Posted April 16, 2007 Well I want the link the act the same way as the input button I have posted. Link to comment https://forums.phpfreaks.com/topic/47173-making-a-text-link-act-the-same-as-a-form-button/#findComment-230424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.