Example 1
The code is as follows |
Copy Code |
<script language=javascript> ie = (document.all)? True:false if (IE) { function Ctlent (eventobject) {if (Event.ctrlkey && window.event.keycode==13) {this.document.form1.submit ();}} } </script> <form action= "add.php" Method=post name=form1> <textarea cols=95 name=content rows=12 wrap=virtual onkeydown=ctlent () > Ctrl+enter Submit Content Information </textarea> <input type=submit value= "Submit" name=submit> </form> |
Wordpress–ctrl+enter
Control Panel → appearance → edit →comment.php, found in this area:
The code is as follows |
Copy Code |
<textarea name= "comment" id= "comment" cols= "70%" rows= "Ten" tabindex= "4" ></textarea> Add this passage: Onkeydown= ' if (event.ctrlkey&&event.keycode==13) {document.getElementById (' Submit '). Click (); return false} ;" The last is this: <textarea name= "comment" id= "comment" cols= "70%" rows= "" tabindex= "4" onkeydown= "if (event.ctrlkey&& event.keycode==13) {document.getElementById (' Submit '). Click (); return false}; " ></textarea>
|
Can.
Emlog Implementation Ctrl+enter Submit comments
Insert code behind the button-related code in the template file module.php
The code is as follows |
Copy Code |
<script> $ (function () { $ (document). KeyPress (function (e) { if (e.ctrlkey && E.which = | | e.which = 10) { $ ("#commentform"). Submit (); else if (e.shiftkey && e.which==13 | | e.which = = 10) { $ ("#commentform"). Submit (); } }) }); </script> |
Dedecms Add Ctrl+enter Submit Comment
In the template article_article.html template
Modify Top
Add the following JS code:
The code is as follows |
Copy Code |
<script type= "Text/javascript" > function Tijiao () { var ev = NULL; if (window.event) { EV = window.event; } if (EV!= null&&ev.ctrlkey&& ev.keycode ==13) { Checksubmit (); } } </script> |