求 asp 页面加 弹出下拉菜单的代码
页面内有个文字,鼠标放到这几个文字上,弹出一个菜单,点其中的项,跳转到不同的网页。我又个javascript代码,放在html格式的网页就行,显示正常,为什么asp网页里...
页面内有个文字,鼠标放到这几个文字上,弹出一个菜单,点其中的项,跳转到不同的网页。
我又个javascript代码,放在html格式的网页就行,显示正常,为什么asp网页里面就不行呢,压根儿不弹出来,郁闷? 展开
我又个javascript代码,放在html格式的网页就行,显示正常,为什么asp网页里面就不行呢,压根儿不弹出来,郁闷? 展开
展开全部
<style type="text/css">
ul{list-style:none;margin:0px;padding:0px;}
li{list-style:none;margin:0px;padding:0px;}
ul{margin-top:50px;}
ul li{margin-top:10px;}
ul li span{display:block;width:127px;cursor:pointer;height:26px;color:#000000;text-align:left;text-indent:10px;line-height:26px;background-image:url(../images/lm_bg.gif)}
ul li a{display:block;width:127px;cursor:pointer;height:26px;color:#000000;text-align:left;text-indent:10px;line-height:26px;background-image:url(../images/lm_bg.gif)}
div#sub_menu_field{position:absolute;left:0px;top:0px;width:250px;display:none;background-color:#FFFFFF;;border:1px solid #CCCCCC;}
div#sub_menu_field a{border-bottom:1px solid #AAAAAA;clear:both;line-height:25px;display:block;text-indent:10px;text-align:left;color:#000000;white-space:nowrap;}
div#sub_menu_field a:hover{color:#FF0000;background-color:#FFCC99}
</style>
<ul>
<li><span onmouseover="show_sub_menu(this, 0);" onmouseout="hide_sub_menu();">11111</span></li>
<li><span onmouseover="show_sub_menu(this, 1);" onmouseout="hide_sub_menu();">22222</span></li>
<li><span onmouseover="show_sub_menu(this, 2);" onmouseout="hide_sub_menu();">33333</span></li>
<li><span onmouseover="show_sub_menu(this, 3);" onmouseout="hide_sub_menu();">44444</span></li>
</ul>
<div id="sub_menu_field" onmouseover="show_sub_menu(this, -1);" onmouseout="hide_sub_menu();"></div>
<script language="javascript">
var sub_menu = new Array();
var i = 0;
sub_menu[i++] = new Array(
new Array('1111111111', 'about.asp?SectionID=20'),
new Array('1111111112', 'about.asp?SectionID=21'),
new Array('1111111113', 'about.asp?SectionID=22')
);
sub_menu[i++] = new Array(
new Array('2222222221', 'center.asp'),
new Array('2222222222', 'about.asp?SectionID=23'),
new Array('2222222223', 'about.asp?SectionID=24')
);
sub_menu[i++] = new Array(
new Array('3333333331', 'about.asp?SectionID=28'),
new Array('3333333332', 'about.asp?SectionID=26')
);
sub_menu[i++] = new Array(
new Array('4444444441', 'register.asp?t=118'),
new Array('4444444442', 'register.asp?t=119'),
new Array('4444444443', 'detial.asp?SectionID=34&ArticleID=120')
);
var hd = null;
function show_sub_menu(obj, key){
window.clearTimeout(hd);
if(key > sub_menu.length - 1 || key < 0)return;
var s = document.getElementById("sub_menu_field");
if(!s)return;
var x = get_pos(obj, "Left");
var y = get_pos(obj, "Top");
try{
s.style.display = 'block';
s.style.left = (x + 100) + "px";
s.style.top = y + "px";
}
catch(e){
s.display = 'block';
s.left = (x + 100) + "px";
s.top = y + "px";
}
s.innerHTML = '';
for(var i = 0; i < sub_menu[key].length; i++){
s.innerHTML += '<a href="' + sub_menu[key][i][1] + '">' + sub_menu[key][i][0] + '</a>'
}
}
function get_pos(el, sProp)
{
var iPos = 0;
while (el)
{
iPos += el["offset" + sProp];
el = el.offsetParent;
}
return iPos;
}
function hide_sub_menu(){
hd = window.setTimeout("hid()", 100);
}
function hid(){
var s = document.getElementById("sub_menu_field");
if(!s)return;
s.innerHTML = '';
try{
s.style.display = 'none';
}
catch(e){
s.display = 'none';
}
}
</script>
ul{list-style:none;margin:0px;padding:0px;}
li{list-style:none;margin:0px;padding:0px;}
ul{margin-top:50px;}
ul li{margin-top:10px;}
ul li span{display:block;width:127px;cursor:pointer;height:26px;color:#000000;text-align:left;text-indent:10px;line-height:26px;background-image:url(../images/lm_bg.gif)}
ul li a{display:block;width:127px;cursor:pointer;height:26px;color:#000000;text-align:left;text-indent:10px;line-height:26px;background-image:url(../images/lm_bg.gif)}
div#sub_menu_field{position:absolute;left:0px;top:0px;width:250px;display:none;background-color:#FFFFFF;;border:1px solid #CCCCCC;}
div#sub_menu_field a{border-bottom:1px solid #AAAAAA;clear:both;line-height:25px;display:block;text-indent:10px;text-align:left;color:#000000;white-space:nowrap;}
div#sub_menu_field a:hover{color:#FF0000;background-color:#FFCC99}
</style>
<ul>
<li><span onmouseover="show_sub_menu(this, 0);" onmouseout="hide_sub_menu();">11111</span></li>
<li><span onmouseover="show_sub_menu(this, 1);" onmouseout="hide_sub_menu();">22222</span></li>
<li><span onmouseover="show_sub_menu(this, 2);" onmouseout="hide_sub_menu();">33333</span></li>
<li><span onmouseover="show_sub_menu(this, 3);" onmouseout="hide_sub_menu();">44444</span></li>
</ul>
<div id="sub_menu_field" onmouseover="show_sub_menu(this, -1);" onmouseout="hide_sub_menu();"></div>
<script language="javascript">
var sub_menu = new Array();
var i = 0;
sub_menu[i++] = new Array(
new Array('1111111111', 'about.asp?SectionID=20'),
new Array('1111111112', 'about.asp?SectionID=21'),
new Array('1111111113', 'about.asp?SectionID=22')
);
sub_menu[i++] = new Array(
new Array('2222222221', 'center.asp'),
new Array('2222222222', 'about.asp?SectionID=23'),
new Array('2222222223', 'about.asp?SectionID=24')
);
sub_menu[i++] = new Array(
new Array('3333333331', 'about.asp?SectionID=28'),
new Array('3333333332', 'about.asp?SectionID=26')
);
sub_menu[i++] = new Array(
new Array('4444444441', 'register.asp?t=118'),
new Array('4444444442', 'register.asp?t=119'),
new Array('4444444443', 'detial.asp?SectionID=34&ArticleID=120')
);
var hd = null;
function show_sub_menu(obj, key){
window.clearTimeout(hd);
if(key > sub_menu.length - 1 || key < 0)return;
var s = document.getElementById("sub_menu_field");
if(!s)return;
var x = get_pos(obj, "Left");
var y = get_pos(obj, "Top");
try{
s.style.display = 'block';
s.style.left = (x + 100) + "px";
s.style.top = y + "px";
}
catch(e){
s.display = 'block';
s.left = (x + 100) + "px";
s.top = y + "px";
}
s.innerHTML = '';
for(var i = 0; i < sub_menu[key].length; i++){
s.innerHTML += '<a href="' + sub_menu[key][i][1] + '">' + sub_menu[key][i][0] + '</a>'
}
}
function get_pos(el, sProp)
{
var iPos = 0;
while (el)
{
iPos += el["offset" + sProp];
el = el.offsetParent;
}
return iPos;
}
function hide_sub_menu(){
hd = window.setTimeout("hid()", 100);
}
function hid(){
var s = document.getElementById("sub_menu_field");
if(!s)return;
s.innerHTML = '';
try{
s.style.display = 'none';
}
catch(e){
s.display = 'none';
}
}
</script>
展开全部
<form name="form1" method="post" action="">
<select name="select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</form>
<select name="select">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</form>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一般下拉菜单,不是用层显示,就用JS代码,用FORM的下拉框也是一种方法.用JS代码,你可以到有下拉菜单的网页上,保存网页就会在文件夹里看到他的JS代码,你改一下他的文子就可以用了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询