<select>
<option>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>
<a href="addnews.php?action=addnew">添加新闻</a>
如果我使用默认的如:--所有栏目-- 那么,我点击添加新闻的话,则提示“请选择要添加的栏目”,如果我选择企业访谈的话,则可以进入下一不
<option>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>
<a href="addnews.php?action=addnew">添加新闻</a>
如果我使用默认的如:--所有栏目-- 那么,我点击添加新闻的话,则提示“请选择要添加的栏目”,如果我选择企业访谈的话,则可以进入下一不
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
var $ = function(id){
return document.getElementById(id);
};
var jump = function(){
if($('myselect').selectedIndex == 0){
alert("请选择企业栏目");
}else{
window.location.href = 'addnews.php?action=addnew';
}
};
</script>
</HEAD><BODY>
<select id="myselect">
<option>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>
<a href="javascript:jump()">添加新闻</a>
</BODY>
</HTML>
<html>
<head>
<title> New Document </title>
</head> <body>
<select id="s">
<option>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>
<a href="addnews.php?action=addnew" onclick="return sub();">添加新闻</a><script type="text/javascript">
var sub=function(){
var s=document.getElementById("s");
if(0 == s.selectedIndex){
alert("请选择栏目");
return false;
}
return true;
}
</script>
</body>
</html>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
<tr>
<form name="addnews" action="addnews.php" method="GET">
<th width="90%" align="right">
<div align="right">
<select name="newtypeid" id="newtypeid">
<option value="0">--所有栏目--</option>
<?php
$sql = "select * from newtype";
$conn = mysql_connect("localhost","root","123456");
$st = mysql_select_db("install",$conn);
mysql_query("set names gbk");
$rs = mysql_query($sql);;
while ($row = mysql_fetch_array($rs, MYSQL_BOTH))
{
echo "<option value=".$row[typeid].">".$row["typetitle"]."</option>"; }
mysql_free_result($rs);
mysql_close($conn);
?>
</select>
</div></th>
<th width="10%" align="right"><input name="addnews" type="submit" value="添加新闻"></th>
</form>
</tr>
</table>
if(s.options[s.selectedIndex].text == "--所有栏目--")
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
var $ = function(id){
return document.getElementById(id);
};
var jump = function(){
if($('myselect').value== 0){
alert("请选择企业栏目");
}else{
do what you want to do..........
}
};
</script>
</HEAD><BODY>
<select id="myselect">
<option value=0>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>我个人觉得还是这样好点。
<option value="1">企业访谈</option>
<option value="1">企业访谈</option>
<option value="1">企业访谈</option>
<option value="1">企业访谈</option>
<option value="1">企业访谈</option>你的上一贴我给你写过一个了
<!--
window.onload = function(){
var a = document.getElementById("addnews");
a.onclick = function(){
var sel = document.getElementById("select");
if(sel.options[0].selected){
alert("请选择要添加的栏目!");
return false;
}
};
}
-->
</script>
</head>
<body>
<select id="select">
<option>--所有栏目--</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
<option>企业访谈</option>
</select>
<a id="addnews" href="addnews.php?action=addnew">添加新闻</a>
</body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
<tr>
<form name="addnews" action="addnews.php" method="GET">
<th width="90%" align="right">
<div align="right">
<select name="newtypeid" id="newtypeid">
<option value="0">--所有栏目--</option>
<?php
$sql = "select * from newtype";
$conn = mysql_connect("localhost","root","123456");$st = mysql_select_db("install",$conn);
mysql_query("set names gbk");
$rs = mysql_query($sql);;
while ($row = mysql_fetch_array($rs, MYSQL_BOTH))
{echo "<option value=".$row[typeid].">".$row["typetitle"]."</option>";}
mysql_free_result($rs);
mysql_close($conn);?>
</select>
</div></th>
<th width="10%" align="right"><input name="addnews" type="submit" value="添加新闻"></th>
</form>
</tr>
</table>
if($('newtypeid').selectedIndex == 0){
alert("请选择企业栏目");
}else{
window.location.href = 'addnews.php?action=addnew';
}
};