>  기사  >  백엔드 개발  >  php中加入javascript想要没有输入title的时候跳出对话框以后在回到ckeditor里面重新编辑。

php中加入javascript想要没有输入title的时候跳出对话框以后在回到ckeditor里面重新编辑。

WBOY
WBOY원래의
2016-06-23 14:16:481039검색

PHP JavaScript ckeditor


我这样可以弹出这个消息提示框
我用了一个if语句。然后想要实现一个功能:按了确定以后在回到首页。可是当我添加了注释掉的这句话以后就是直接跳转到之前的页面了,不会弹出对话框了。怎么办

求解!!!
这是a.php:
<?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>&nbsp&nbsp&nbsp&nbsp</u>$head<br/>";   	    echo "<u>date:</u>&nbsp&nbsp&nbsp&nbsp".date("Y").".".date('m').".".date('d');   	    echo"<br/>";        echo "<u>content</u>:</br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp        	<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>




这是ck.php
[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">


var checkform=function(){
    
}

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.