Heim >Backend-Entwicklung >PHP-Tutorial >php中加入javascript想要没有输入title的时候跳出对话框以后在回到ckeditor里面重新编辑。
PHP JavaScript ckeditor
<?phpinclude('conn.php');$head=$_POST['head'];$content=$_POST['content'];?><html><head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><title>a</title> <meta name="keywords" content="关键字列表" /> <meta name="description" content="网页描述" /> <link rel="stylesheet" type="text/css" href="" /> <style type="text/css"> *{ font-size:20px; /*设置当前网页的“基本字体大小为12px*/ } .content{ color=#0066ff text-align=right border-bottom=dashed 1px grey }</style></head><body> <?php if($head!=NULL) { $sql="insert into ckfinder values('$head','$content')"; mysql_query($sql) or die(mysql_error()); $sql="select *from ckfinder"; echo "<u>title:</u>    </u>$head<br/>"; echo "<u>date:</u>    ".date("Y").".".date('m').".".date('d'); echo"<br/>"; echo "<u>content</u>:</br>         <table border='0' width='400' align='left' cellspacing='0' ><tr><td class='.content' >$content</td></tr><table>"; echo"</hr>" ; } else { echo"<script type='text/javascript'>alert('请输入标题!')</script>"; header("Location:ck.php"); } ?> </body></html>
[code=php]<html><head> <meta http-equiv="Content-Type"Content="text/html;charset=utf-8"> <title> ckeditor与ckfinder的配置和调用 </title><script type="text/javascript" src="ckeditor/ckeditor.js"></script><script type="text/javascript" src="ckfinder/ckfinder.js"></script></head><body><form action="a.php" method="post"> <table> <tr> <td> title:<input type="text" name="head"/> </td> </tr> <tr> <td> date: <?php echo date("Y").".".date('m').".".date('d'); ?> </td> </tr> </table> <textarea name="content" class="ckeditor"></textarea><input type="submit" value="do"><script type="text/javascript">CKEDITOR.replace( 'content',{filebrowserBrowseUrl : '/ckfinder/ckfinder.html',filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?Type=Images',filebrowserFlashBrowseUrl : '/ckfinder/ckfinder.html?Type=Flash',filebrowserUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',filebrowserImageUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',filebrowserFlashUploadUrl : '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'});</script></form></body></html>
检查标题框是否为空的动作应在 表单的 onsubmit 事件中进行
能说清楚一点么?具体操作?
检查标题框是否为空的动作应在 表单的 onsubmit 事件中进行 能说清楚一点么?具体操作?
表单页面
<form name="form" method="post" action="" onsubmit="return checkform">