需求个js 实现点击文字选中复选框特效

需求个js 实现点击文字选中复选框特效,第1张

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<meta name="keywords" content="站长,网页特效,js特效,广告代码,zzjs,zzjsnet,sky,wwwzzjsnet,站长特效 网" />

<meta name="description" content="wwwzzjsnet,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" />

<title>点击文字选中单选框,sky整理收集,站长特效欢迎您。</title>

<style type="text/css">

<!--

body { font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}

A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }

A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }

a:active { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

-->

</style>

</head>

<body>

<a href="http://wwwzzjsnet/">站长特效网</a>,站长必备的高质量网页特效和广告代码。zzjsnet,站长js特效。<hr>

<!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:wwwzzjsnet,zzjs@msncom,用net打造靓站-->

<script type="text/javascript" src="http://wwwzzjsnet/ad/tcjs"></script>

<center>

<table border=0 bordercolor=#111111 borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">

<tr><td align=center>

<font size=3 color=#FF0033 face="Arial, Helvetica, sans-serif">

<strong style="font-weight: 400">下面为脚本显示区<br>

 </strong></font></td></tr><tr><td align=center width=300> <p>

<span style="font-size: 9pt">看看下面的选择框,似乎没有什么不同的。微妙之处在于,选择项目时不必非得在框内点击鼠标了,在文本上选择即可。不信试一试吧。</span></p>

<form>

<label for="check1"><span style="font-size: 9pt">经常来这里</span></label><span style="font-size: 9pt">

<input type="CHECKBOX" id="check1" value="often" name="checkoften">

<label for="check2">偶尔来看看</label>

<input type="CHECKBOX" id="check2" value="seldom" name="checkseldom">

</span>

</form>

</td></tr></table></center>

<br>

<br>

<br>

<br>

<br>

<br>

<br>

<br>

</body>

</html>

你不是写了2个function呢,元素的事件调用你想要调用的function不就可以了么?

<script type="text/javascrtip>

function A{……}

function B{……}

</script>

例如:btn1的onclick事件触发A,btn2的onclick事件触发B。。。这样就可以咯~~~

<html>

<head>

<title>title及alt提示特效</title>

<style type="text/css">

body{font-size:12px;color:#000000}

td{font-size:12px;color:#000000}

a:link{font-size:12px;color:#000000}

</style>

<script language="javascript">

var pltsPop=null;

var pltsoffsetX = 12; // 弹出窗口位于鼠标左侧或者右侧的距离;3-12 合适

var pltsoffsetY = 15; // 弹出窗口位于鼠标下方的距离;3-12 合适

var pltsTitle="";

documentwrite('<div id=pltsTipLayer style="display: none;position: absolute; z-index:10001"></div>');

function pltsinits()

{

documentonmouseover = plts;

documentonmousemove = moveToMouseLoc;

}

function plts()

{ var o=eventsrcElement;

if(oalt!=null && oalt!=""){odypop=oalt;oalt=""};

if(otitle!=null && otitle!=""){odypop=otitle;otitle=""};

pltsPop=odypop;

if(pltsPop!=null && pltsPop!="" && typeof(pltsPop)!="undefined")

{

pltsTipLayerstyleleft=-1000;

pltsTipLayerstyledisplay='';

var Msg=pltsPopreplace(/\n/g,"<br>");

Msg=Msgreplace(/\0x13/g,"<br>");

var re=/\{([^\{])\}/ig;

if(!retest(Msg))pltsTitle="『水木设计联盟』";

else{

re=/\{([^\{])\}()/ig;

pltsTitle=Msgreplace(re,"$1")+" ";

re=/\{([^\{])\}/ig;

Msg=Msgreplace(re,"");

Msg=Msgreplace("<br>","");}

var content =

'<table style="FILTER:alpha(opacity=90);border: 1px solid #cccccc" id="toolTipTalbe" cellspacing="1" cellpadding="0"><tr><td width="100%"><table bgcolor="#ffffff" cellspacing="0" cellpadding="0">'+

'<tr id="pltsPoptop"><td height="20" bgcolor="#0094bb"><font color="#ffffff"><b><p id="topleft" align="left">↖'+pltsTitle+'</p><p id="topright" align="right" style="display:none">'+pltsTitle+'↗</font></b></font></td></tr>'+

'<tr><td "+attr+" style="padding-left:10px;padding-right:10px;padding-top: 8px;padding-bottom:6px;line-height:140%">'+Msg+'</td></tr>'+

'<tr id="pltsPopbot" style="display:none"><td height="20" bgcolor="#0094bb"><font color="#ffffff"><b><p id="botleft" align="left">↙'+pltsTitle+'</p><p id="botright" align="right" style="display:none">'+pltsTitle+'↘</font></b></font></td></tr>'+

'</table></td></tr></table>';

pltsTipLayerinnerHTML=content;

toolTipTalbestylewidth=Mathmin(pltsTipLayerclientWidth,documentbodyclientWidth/22);

moveToMouseLoc();

return true;

}

else

{

pltsTipLayerinnerHTML='';

pltsTipLayerstyledisplay='none';

return true;

}

}

function moveToMouseLoc()

{

if(pltsTipLayerinnerHTML=='')return true;

var MouseX=eventx;

var MouseY=eventy;

var popHeight=pltsTipLayerclientHeight;

var popWidth=pltsTipLayerclientWidth;

if(MouseY+pltsoffsetY+popHeight>documentbodyclientHeight)

{

popTopAdjust=-popHeight-pltsoffsetY15;

pltsPoptopstyledisplay="none";

pltsPopbotstyledisplay="";

}

else

{

popTopAdjust=0;

pltsPoptopstyledisplay="";

pltsPopbotstyledisplay="none";

}

if(MouseX+pltsoffsetX+popWidth>documentbodyclientWidth)

{

popLeftAdjust=-popWidth-pltsoffsetX2;

topleftstyledisplay="none";

botleftstyledisplay="none";

toprightstyledisplay="";

botrightstyledisplay="";

}

else

{

popLeftAdjust=0;

topleftstyledisplay="";

botleftstyledisplay="";

toprightstyledisplay="none";

botrightstyledisplay="none";

}

pltsTipLayerstyleleft=MouseX+pltsoffsetX+documentbodyscrollLeft+popLeftAdjust;

pltsTipLayerstyletop=MouseY+pltsoffsetY+documentbodyscrollTop+popTopAdjust;

return true;

}

pltsinits();

</script>

</head>

<body>

链接提示效果:<a href="http://wwwlanrentukucom/" target="_blank" title="title及alt提示特效,本程序由水木设计联盟整理推荐,希望大家喜欢">一个很酷的鼠标悬停特效,但有问题指教,我想知道怎么控制悬停时间</a>

<img src="http://wwwmb5ucom/images/logogif" alt="模板无忧1号站">

<img src="http://wwwmb5ucom/images/logogif" alt="模板无忧2号站">

<a href="#"><img src="http://wwwmb5ucom/images/logogif" alt="模板无忧3号站" border="0"></a>

<div style="visibility:hidden;border:0px solid #000000;background-color:#333333;font-size:12px;color:#6699cc;position:absolute;" id=altlayer></div>

<script>

documentbodyonmousemove=quickalt;

function quickalt() {

if (eventsrcElementhint)eventsrcElementalt=eventsrcElementhint;

if(eventsrcElementalt && eventsrcElementalt!='') {

eventsrcElementhint=eventsrcElementalt;

altlayerstylevisibility='visible';

altlayerstyleleft=eventx-1;

altlayerstyletop=eventy+16;

altlayerinnerHTML=eventsrcElementhint

eventsrcElementalt="";

}

else altlayerstylevisibility='hidden';}

</script>

</body>

</html>

看看这个

改好了`要优化`修改了HTML页面和其JS`CSS没动

<link href="csscss" rel="stylesheet" type="text/css">

<script>

<!--

var s=490;

var minheight=52;

var maxheight=200;

function shoppingcat(obj){

var key = objinnerText;

var content=documentgetElementById("content");

if(contentstylepixelHeight==0)contentstylepixelHeight=minheight;

if(key=="展开"){

contentstylepixelHeight+=s;

if(contentstylepixelHeight<maxheight){

setTimeout("shoppingcat();",1);

}else{

objinnerText="关闭";

}

}else{

contentstylepixelHeight-=s;

if(contentstylepixelHeight>minheight){

setTimeout("shoppingcat(obj);",1);

}else{

objinnerText="展开";

}

}

}

function MM_jumpMenu(targ,selObj,restore){ //v30

eval(targ+"location='"+selObjoptions[selObjselectedIndex]value+"'");

if (restore) selObjselectedIndex=0;

}

//-->

</script>

<style type="text/css">

<!--

STYLE1 {color: #DAE0E0}

-->

</style>

<div id="content2">

<table width="860" border="0">

<tr>

<td width="854"><select name="menu1" onchange="MM_jumpMenu('parent',this,0)">

<option>足球</option>

<option>美式足球</option>

</select>

<select name="select2" onchange="MM_jumpMenu('parent',this,0)">

<option>3</option>

</select>

<select name="select3" onchange="MM_jumpMenu('parent',this,0)">

<option>2</option>

</select>

<select name="select4" onchange="MM_jumpMenu('parent',this,0)">

<option>1</option>

</select>

<label>

<input type="submit" name="Submit" value="提交" />

</label></td>

</tr>

</table>

<table width="858" height="30" border="1" cellpadding=0 cellspacing=0 bordercolor=#000000 bordercolordark=#ffffff bgcolor="EDEFEE">

<tr>

<td width="21" height="30" align="center" bgcolor="#000000" style="cursor: hand"><b><img src="images/+gif" alt="展开" width="11" height="11" /></b></td>

<td width="194" bgcolor="#000000"><div align="center" class="xingcheng">赛事</div></td>

<td width="119" bgcolor="#000000"><div align="center" class="xingcheng">时间</div></td>

<td colspan="2" bgcolor="#000000"><div align="center" class="xingcheng">大于2个结果则进行分页</div></td>

<td width="58" bgcolor="#000000"><div align="center" class="xingcheng">修改</div></td>

<td width="69" bgcolor="#000000"><div align="center" class="xingcheng">删除</div></td>

</tr>

</table>

</div>

<div id="content" name="content">

<table width="858" height="452" border=1 align="center" cellpadding=0 cellspacing=0 bordercolor=#000000 bordercolordark=#ffffff bgcolor="EDEFEE">

<tr>

<td width=21 height="30" align="center" style="cursor: hand">

<span id="key" name="keyname" onclick="shoppingcat(this);">展开</span>

</td>

<td width="197"><div align="center"><span class="text_saishi_12">1VS2</span><br />

<span class="text_saishi_12_a">2010</span></div></td>

<td width="119" height="40"> </td>

<td width="192"><div align="center"><span class="text_saishi_12">1</span></div></td>

<td width="192"><div align="center"><span class="text_saishi_12">1</span></div></td>

<td width="59"><div align="center"><img src="images/tongjigif" width="19" height="17" /></div></td>

<td width="64"><div align="center" ><img src="images/shanchugif" width="23" height="18" /></div></td>

</tr>

<tr>

<td height="30" colspan="2" align="center" style="cursor: hand"> </td>

<td bgcolor="#D61125"><div align="center" class="text_hui_12">a</div></td>

<td bgcolor="#D61125"><div align="center" class="text_hui_12">b</div></td>

<td bgcolor="#D61125"><div align="center" class="text_hui_12">c</div></td>

<td> </td>

<td> </td>

</tr>

<tr>

<td height="30" colspan="2" rowspan="3" align="center" style="cursor: hand"> </td>

<td rowspan="3"><div align="center" class="text_saishi_12_a">d</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td height="40"> </td>

<td> </td>

</tr>

<tr>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td height="40" bgcolor="#DAE0E0"> </td>

<td bgcolor="#DAE0E0"> </td>

</tr>

<tr>

<td><div align="center" class="xingcheng3">e</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td height="40"> </td>

<td> </td>

</tr>

<tr>

<td height="30" colspan="2" rowspan="3" align="center" style="cursor: hand"> </td>

<td rowspan="3"><div align="center" class="text_saishi_12_a">1</div></td>

<td bgcolor="#DAE0E0"> </td>

<td bgcolor="#DAE0E0"> </td>

<td bgcolor="#DAE0E0" height="40"> </td>

<td bgcolor="#DAE0E0"> </td>

</tr>

<tr>

<td><div align="center" class="xingcheng3">e</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td height="40"> </td>

<td> </td>

</tr>

<tr>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td bgcolor="#DAE0E0" height="40"> </td>

<td bgcolor="#DAE0E0"> </td>

</tr>

<tr>

<td height="30" colspan="2" rowspan="3" align="center" style="cursor: hand"> </td>

<td rowspan="3"><div align="center" class="text_saishi_12_a">1</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td> </td>

<td height="40"> </td>

</tr>

<tr>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td bgcolor="#DAE0E0"><div align="center" class="xingcheng3">e</div></td>

<td bgcolor="#DAE0E0"> </td>

<td height="40" bgcolor="#DAE0E0"> </td>

</tr>

<tr>

<td><div align="center" class="xingcheng3">e</div></td>

<td><div align="center" class="xingcheng3">e</div></td>

<td> </td>

<td height="40"> </td>

</tr>

<tr>

<td height="30" colspan="2" align="center" style="cursor: hand"> </td>

<td> </td>

<td height="100" colspan="4" bgcolor="#DAE0E0"><span class="text_saishi_12_a">1</span></td>

</tr>

</table>

</div><br>

<div id="cholder">

    <canvas id="canvas"></canvas>

</div>

<div class="container">我是内容内容内容……</div><!--/这里是新增的-->#canvas {position:absolute;top:0px;left:0px;z-index:1; }

container{position:relative;background:#FFF;color:#03Cz-index:2;}

定位后用z-index来控制,值大的居于上层。

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/3107444.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-02-05
下一篇2024-02-05

发表评论

登录后才能评论

评论列表(0条)

    保存