怎么实现在点MP3的选项时,显示的JS是,1.js
<div class="keyword">
<script src="1.js"></script> </div>点MP4选项时,JS就变成
<div class="keyword">
<script src="3.js"></script> </div>如何修改才能实现上面的功能:代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
/* --整体-- */
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #dfd3b9;
background-repeat: repeat-x;
font-family:"宋体",Verdana, Helvetica, sans-serif;
font-size: 12px;
color: #000;
}
div, ul, li, ol, form, h1, h2, h3, h4, h5, h6, h7, img,p { margin: 0px; padding: 0px; list-style: none; }
img{border:0 none;}
a {
font-size: 12px;
color: #000000;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
/* -- 头部 -- */.top{ width:970px; height:132px; overflow:hidden}
.top .logo{ width:233px; height:120px; float:left;}
.top .con{ width:730px; height:120px; float:right;}.top .con .lc{ width:630px; float:left;padding:40px; 0 0 20px}
.top .con .lc .tab_btn { height: 25px; overflow: hidden;}
.top .con .lc .tab_btn li { float: left; width: 40px; height: 25px;line-height: 25px; text-align: center; cursor: pointer; font-weight: normal; font-size: 12px; margin:0 4px 0 0; }
.top .con .lc .tab_btn li a.here{
color: #fff;
font-weight: bold;
background-color: #77602a;display:block
}
.top .con .lc .tab_btn li a{ color: #e7dfca; font-weight: normal; background-color: #433412; display:block}.top .con .lc .wrap {background-image: url();background-repeat: no-repeat;}
.top .con .lc .tab_box {}
.top .con .lc .tab_box .guang{width:600px;height:28px; overflow:hidden; padding:2px 0 0 0;}
.top .con .lc .tab_box .keyword{color: #fff;}
.top .con .lc .tab_box .guang .zltsearch_i{
width:510px;
height:25px;
font-size:14px;
color:#000;
line-height:25px;
float:left; margin:0 0 0 4px;}
.top .con .lc .tab_box .guang .zltsearch_s{
float:right;
background-image: url();
background-repeat: no-repeat;
height: 26px;
width: 71px;
margin-top: 0;
margin-right: 2px;
margin-bottom: 0;
margin-left: 0;
border:0
}.top .con .ls{ width:90px; float:right;}
.top .con .ls ul{ padding-top:40px}
-->
</style>
<script src="http://product.pcpop.com/js/jquery.js"></script>
<script>
function subQuery()
{
var searchTypeId = document.sform1.searchType.value;
//alert(document.sform1.searchType.value);
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
var url = "";
switch(searchTypeId)
{
case "1":
url ='1';
break;
case "2":
url ='1';
break;
case "3":
url ='1';
break;
} var formSubmit =document.getElementById('sform1');
formSubmit.action=url;
//formSubmit.submit();
//return false;
}
function shosearch(sid)
{
var searchform = document.sform1.searchType;
var hform = document.sform1;
searchform.value=sid;
for(var si =1;si<=3;si++)
{
document.getElementById("tab8_"+si).className="";
}
document.getElementById("tab8_"+sid).className="here";
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
switch(sid)
{
case 1:
hform.query1.style.display="none";
hform.query.style.display="";
break;
case 2:
hform.query1.style.display="";
hform.query.style.display="none";
break;
case 3:
hform.query1.style.display="";
hform.query.style.display="none";
break;
default:
hform.query.style.display="";
hform.query1.style.display="none";
break;
}
if (sid==1)
{
if (keyWordNews!="")
document.getElementById("query").value = keyWordNews;
}
else
{
if (keyWord!="")
{
document.getElementById("query1").value = keyWord;
}
}
}
</script></head>
<body>
<div class="box"> <div class="top">
<div class="logo"></div>
<div class="con"> <div class="lc">
<ul class="tab_btn">
<li><a class="here" href="javascript:void(0)" id="tab8_1" onClick="shosearch(1);" target="_self" onFocus="this.blur()">MP3</a>
</li>
<li><a href="javascript:void(0)" id="tab8_2" onClick="shosearch(2);" target="_self" onFocus="this.blur()">MV</a></li>
<li><a href="javascript:void(0)" id="tab8_3" onClick="shosearch(3);" target="_self" onFocus="this.blur()">MP4</a>
</li> </ul>
<div class="wrap">
<div class="tab_box">
<div class="guang">
<form name="sform1" id="sform1" method="post" target="_blank" action="" onSubmit="subQuery();">
<input type="text" class="zltsearch_i" id="query" name="query" value="" /><input type="text" class="zltsearch_i" id="query1" name="query1" style="display:none;" onClick="sform1.query.value=''" /><input type="submit" class="zltsearch_s" id="btnFSearch" value="搜索" /><input type="hidden" value="1" name="searchType" id="searchType">
</FORM>
</div>
<div class="keyword">
<script src="1.js"></script> </div>
</div>
</div>
</div>
<div class="ls">
<ul>
<li></li>
</ul>
</div> </div>
</div>
</div>
</body>
</html>
<div class="keyword">
<script src="1.js"></script> </div>点MP4选项时,JS就变成
<div class="keyword">
<script src="3.js"></script> </div>如何修改才能实现上面的功能:代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
/* --整体-- */
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #dfd3b9;
background-repeat: repeat-x;
font-family:"宋体",Verdana, Helvetica, sans-serif;
font-size: 12px;
color: #000;
}
div, ul, li, ol, form, h1, h2, h3, h4, h5, h6, h7, img,p { margin: 0px; padding: 0px; list-style: none; }
img{border:0 none;}
a {
font-size: 12px;
color: #000000;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
/* -- 头部 -- */.top{ width:970px; height:132px; overflow:hidden}
.top .logo{ width:233px; height:120px; float:left;}
.top .con{ width:730px; height:120px; float:right;}.top .con .lc{ width:630px; float:left;padding:40px; 0 0 20px}
.top .con .lc .tab_btn { height: 25px; overflow: hidden;}
.top .con .lc .tab_btn li { float: left; width: 40px; height: 25px;line-height: 25px; text-align: center; cursor: pointer; font-weight: normal; font-size: 12px; margin:0 4px 0 0; }
.top .con .lc .tab_btn li a.here{
color: #fff;
font-weight: bold;
background-color: #77602a;display:block
}
.top .con .lc .tab_btn li a{ color: #e7dfca; font-weight: normal; background-color: #433412; display:block}.top .con .lc .wrap {background-image: url();background-repeat: no-repeat;}
.top .con .lc .tab_box {}
.top .con .lc .tab_box .guang{width:600px;height:28px; overflow:hidden; padding:2px 0 0 0;}
.top .con .lc .tab_box .keyword{color: #fff;}
.top .con .lc .tab_box .guang .zltsearch_i{
width:510px;
height:25px;
font-size:14px;
color:#000;
line-height:25px;
float:left; margin:0 0 0 4px;}
.top .con .lc .tab_box .guang .zltsearch_s{
float:right;
background-image: url();
background-repeat: no-repeat;
height: 26px;
width: 71px;
margin-top: 0;
margin-right: 2px;
margin-bottom: 0;
margin-left: 0;
border:0
}.top .con .ls{ width:90px; float:right;}
.top .con .ls ul{ padding-top:40px}
-->
</style>
<script src="http://product.pcpop.com/js/jquery.js"></script>
<script>
function subQuery()
{
var searchTypeId = document.sform1.searchType.value;
//alert(document.sform1.searchType.value);
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
var url = "";
switch(searchTypeId)
{
case "1":
url ='1';
break;
case "2":
url ='1';
break;
case "3":
url ='1';
break;
} var formSubmit =document.getElementById('sform1');
formSubmit.action=url;
//formSubmit.submit();
//return false;
}
function shosearch(sid)
{
var searchform = document.sform1.searchType;
var hform = document.sform1;
searchform.value=sid;
for(var si =1;si<=3;si++)
{
document.getElementById("tab8_"+si).className="";
}
document.getElementById("tab8_"+sid).className="here";
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
switch(sid)
{
case 1:
hform.query1.style.display="none";
hform.query.style.display="";
break;
case 2:
hform.query1.style.display="";
hform.query.style.display="none";
break;
case 3:
hform.query1.style.display="";
hform.query.style.display="none";
break;
default:
hform.query.style.display="";
hform.query1.style.display="none";
break;
}
if (sid==1)
{
if (keyWordNews!="")
document.getElementById("query").value = keyWordNews;
}
else
{
if (keyWord!="")
{
document.getElementById("query1").value = keyWord;
}
}
}
</script></head>
<body>
<div class="box"> <div class="top">
<div class="logo"></div>
<div class="con"> <div class="lc">
<ul class="tab_btn">
<li><a class="here" href="javascript:void(0)" id="tab8_1" onClick="shosearch(1);" target="_self" onFocus="this.blur()">MP3</a>
</li>
<li><a href="javascript:void(0)" id="tab8_2" onClick="shosearch(2);" target="_self" onFocus="this.blur()">MV</a></li>
<li><a href="javascript:void(0)" id="tab8_3" onClick="shosearch(3);" target="_self" onFocus="this.blur()">MP4</a>
</li> </ul>
<div class="wrap">
<div class="tab_box">
<div class="guang">
<form name="sform1" id="sform1" method="post" target="_blank" action="" onSubmit="subQuery();">
<input type="text" class="zltsearch_i" id="query" name="query" value="" /><input type="text" class="zltsearch_i" id="query1" name="query1" style="display:none;" onClick="sform1.query.value=''" /><input type="submit" class="zltsearch_s" id="btnFSearch" value="搜索" /><input type="hidden" value="1" name="searchType" id="searchType">
</FORM>
</div>
<div class="keyword">
<script src="1.js"></script> </div>
</div>
</div>
</div>
<div class="ls">
<ul>
<li></li>
</ul>
</div> </div>
</div>
</div>
</body>
</html>
解决方案 »
- 怎么用js取到数组里的每个元素的值
- WebLogic配置错误,求解!!!
- 分享:javascript中实现字符串转日期(string.toDate("yyyyMMdd"))
- radio 的check属性支持 三元运算符吗?谢谢。分不多了,对不住大家了
- 如果获取提交表单的参数值?????? 急
- 菜鸟问题,帮帮忙!
- 用createElement创建的对象如何定义事件
- 页面问题
- 看不懂的脚本, 望高手指点迷津...
- 高手请帮帮忙!如何让浏览过的网页马上过期?
- 如何根据jsp列表中的一行的某一个数据改变改行的颜色
- 如何用javascript来修改TextBox的TextMode属性,把单行变成多行怎么设置
document.getElementById("myScript").src="3.js";
document.getElementById("myScript").src="3.js";加在我JS里的哪个地方呀?谢谢高人
<script type="text/javascript">
function shosearch(sid) {
var searchform = document.sform1.searchType;
var hform = document.sform1;
searchform.value = sid;
for (var si = 1; si <= 3; si++) {
document.getElementById("tab8_" + si).className = "";
}
document.getElementById("tab8_" + sid).className = "here";
var keyWord = document.getElementById("query").value;
var keyWordNews = document.getElementById("query1").value;
hform.query.style.display = "";
hform.query1.style.display = "none";
if (sid == 1) {
if (keyWordNews != "")
document.getElementById("query").value = keyWordNews; }
else {
if (keyWord != "")
document.getElementById("query1").value = keyWord;
}
document.getElementById("keyword").innerHTML = "<script type='text/javascript' src='" + sid.toString() + ".js+'></" + "script>";
}
</script><div class="keyword" id="keyword">
<!--空着就行-->
</div>
{
case 1:
hform.query1.style.display="none";
hform.query.style.display="";
break;
case 2:
hform.query2.style.display="";
hform.query.style.display="none";
break;
case 3:
hform.query3.style.display="";
hform.query.style.display="none";
break;
default:
hform.query.style.display="";
hform.query1.style.display="none";
break;
}
http://blog.csdn.net/llyy112233/archive/2010/11/26/6036268.aspx
是不是document.getElementById("keyword").innerHTML = "<script type='text/javascript' src='" + sid.toString() + ".js+'></" + "script>";写错了,解析不出来
你可以用用window.open 的方式来实现撒!url 重写不就可以了!
我是抠这里的代码
document.getElementById("keyword").innerHTML = "<script type='text/javascript' src='" + sid.toString() + ".js'></" + "script>";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
/* --整体-- */
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #dfd3b9;
background-repeat: repeat-x;
font-family:"宋体",Verdana, Helvetica, sans-serif;
font-size: 12px;
color: #000;
}
div, ul, li, ol, form, h1, h2, h3, h4, h5, h6, h7, img,p { margin: 0px; padding: 0px; list-style: none; }
img{border:0 none;}
a {
font-size: 12px;
color: #000000;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
/* -- 头部 -- */.top{ width:970px; height:132px; overflow:hidden}
.top .logo{ width:233px; height:120px; float:left;}
.top .con{ width:730px; height:120px; float:right;}.top .con .lc{ width:630px; float:left;padding:40px; 0 0 20px}
.top .con .lc .tab_btn { height: 25px; overflow: hidden;}
.top .con .lc .tab_btn li { float: left; width: 40px; height: 25px;line-height: 25px; text-align: center; cursor: pointer; font-weight: normal; font-size: 12px; margin:0 4px 0 0; }
.top .con .lc .tab_btn li a.here{
color: #fff;
font-weight: bold;
background-color: #77602a;display:block
}
.top .con .lc .tab_btn li a{ color: #e7dfca; font-weight: normal; background-color: #433412; display:block}.top .con .lc .wrap {background-image: url();background-repeat: no-repeat;}
.top .con .lc .tab_box {}
.top .con .lc .tab_box .guang{width:600px;height:28px; overflow:hidden; padding:2px 0 0 0;}
.top .con .lc .tab_box .keyword{color: #fff;}
.top .con .lc .tab_box .guang .zltsearch_i{
width:510px;
height:25px;
font-size:14px;
color:#000;
line-height:25px;
float:left; margin:0 0 0 4px;}
.top .con .lc .tab_box .guang .zltsearch_s{
float:right;
background-image: url();
background-repeat: no-repeat;
height: 26px;
width: 71px;
margin-top: 0;
margin-right: 2px;
margin-bottom: 0;
margin-left: 0;
border:0
}.top .con .ls{ width:90px; float:right;}
.top .con .ls ul{ padding-top:40px}
-->
</style>
<script src="http://product.pcpop.com/js/jquery.js"></script>
<script>
function subQuery()
{
var searchTypeId = document.sform1.searchType.value;
//alert(document.sform1.searchType.value);
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
var url = "";
switch(searchTypeId)
{
case "1":
url ='1';
break;
case "2":
url ='1';
break;
case "3":
url ='1';
break;
} var formSubmit =document.getElementById('sform1');
formSubmit.action=url;
//formSubmit.submit();
//return false;
}
function shosearch(sid)
{
var searchform = document.sform1.searchType;
var hform = document.sform1;
searchform.value=sid;
for(var si =1;si<=3;si++)
{
document.getElementById("tab8_"+si).className="";
}
document.getElementById("tab8_"+sid).className="here";
var keyWord =document.getElementById("query").value;
var keyWordNews =document.getElementById("query1").value;
switch(sid)
{
case 1:
hform.query1.style.display="none";
hform.query.style.display="";
break;
case 2:
hform.query1.style.display="";
hform.query.style.display="none";
break;
case 3:
hform.query1.style.display="";
hform.query.style.display="none";
break;
default:
hform.query.style.display="";
hform.query1.style.display="none";
break;
}
if (sid==1)
{
if (keyWordNews!="")
document.getElementById("query").value = keyWordNews;
}
else
{
if (keyWord!="")
document.getElementById("query1").value = keyWord;
}
document.getElementById("keywordw").innerHTML = "<script type='text/javascript' src='" + sid.toString() + ".js'></" + "script>"; }
</script></head>
<body>
<div class="box"> <div class="top">
<div class="logo"></div>
<div class="con"> <div class="lc">
<ul class="tab_btn">
<li><a class="here" href="javascript:void(0)" id="tab8_1" onClick="shosearch(1);" target="_self" onFocus="this.blur()">MP3</a>
</li>
<li><a href="javascript:void(0)" id="tab8_2" onClick="shosearch(2);" target="_self" onFocus="this.blur()">MV</a></li>
<li><a href="javascript:void(0)" id="tab8_3" onClick="shosearch(3);" target="_self" onFocus="this.blur()">MP4</a>
</li> </ul>
<div class="wrap">
<div class="tab_box">
<div class="guang">
<form name="sform1" id="sform1" method="post" target="_blank" action="" onSubmit="subQuery();">
<input type="text" class="zltsearch_i" id="query" name="query" value="" /><input type="text" class="zltsearch_i" id="query1" name="query1" style="display:none;" onClick="sform1.query.value=''" /><input type="submit" class="zltsearch_s" id="btnFSearch" value="搜索" /><input type="hidden" value="1" name="searchType" id="searchType">
</FORM>
</div>
<div class="keyword" id="keywordw">
</div>
</div>
</div>
</div>
<div class="ls">
<ul>
<li></li>
</ul>
</div> </div>
</div>
</div>
</body>
</html>