情况是这样的,我在vs2010中Web页面中弄了一个缩略图,但在 <form id="form1" runat="server"></form>下运行总是显示“Microsoft JScript 运行时错误: 'focpic' 未定义”,但在Web页面去掉<form id="form1" runat="server"></form>运行就不会出错。请大侠们帮解决一下,谢谢。<style>
A
{
text-decoration: none;
}
A:link
{
color: #505050;
}
A:visited
{
color: #505050;
}
A:hover
{
color: #d40005;
text-decoration: underline;
}
A:active
{
color: #f30;
}
IMG
{
border-top-width: 0px;
border-left-width: 0px;
border-bottom-width: 0px;
border-right-width: 0px;
}
.box
{
float: left;
width: 472px;
}
.box .boxpadding
{
padding-right: 8px;
padding-left: 8px;
margin-bottom: 0px;
padding-bottom: 8px;
padding-top: 8px;
}
#Slide
{
clear: both;
border-right: #fff 1px solid;
border-top: #fff 1px solid;
margin-bottom: 6px;
overflow: hidden;
border-left: #fff 1px solid;
width: 450px;
border-bottom: #fff 1px solid;
height: 335px;
}
#Slide A
{
color: #000;
}
.img
{
border-right: #fff 1px solid;
background: #fff;
margin: 0px auto;
border-left: #fff 1px solid;
text-align: center;
}
.boxpadding
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
background: #f8f8f8;
margin-bottom: 8px;
border-left: #fff 1px solid;
padding-top: 10px;
border-bottom: #fff 1px solid;
}
.thumb_title
{
margin-top: 10px;
background: #fff;
filter: alpha(opacity=30);
width: 450px;
text-indent: 10px;
line-height: 25px;
position: absolute;
height: 25px;
-moz-opacity: 0.3;
}
#Slide_Thumb
{
margin-top: 257px;
margin-left: 0px;
position: absolute;
}
.thumb_on
{
display: inline;
float: left;
margin-left: 8px;
cursor: pointer;
}
.thumb_off
{
display: inline;
float: left;
margin-left: 8px;
cursor: pointer;
}
.thumb_off
{
filter: alpha(opacity=50);
-moz-opacity: 0.5;
}
.thumb_on
{
filter: alpha(opacity=100);
-moz-opacity: 1;
}
.thumb_off IMG
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
margin-top: 12px;
border-left: #fff 1px solid;
width: 75px;
border-bottom: #fff 1px solid;
height: 56px;
}
.thumb_on IMG
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
border-left: #fff 1px solid;
width: 91px;
border-bottom: #fff 1px solid;
height: 68px;
}</style>
<table width="472" height="490" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="472">
<div class="box" style="margin-bottom: 8px">
<div class="boxpadding">
<div id="Slide">
<a id="foclnk" href="IndexImage/IMG_0072.JPG" target="_blank">
<img id="focpic" style="filter: RevealTrans(duration=1; ransition=12);
position: absolute; left: 484; top: 94" src="IndexImage/IMG_0072.JPG" width="450"
height="335" alt="" />
</a>
<div class="thumb_title" id="foctitle">
<a href="IndexImage/IMG_0072.JPG" target="_blank">图一</a></div>
<div id="Slide_Thumb">
<div class="thumb_on" id="tmb0" onmouseover="setfoc(0);" onmouseout="playit();">
<a href="
IndexImage/IMG_0072.JPG" target="_blank">
<img alt="图一" src="IndexImage/IMG_0072.JPG" /></a></div>
<div class="thumb_off" id="tmb1" onmouseover="setfoc(1);" onmouseout="playit();">
<a href="IndexImage/IMG_0075.JPG" target="_blank">
<img alt="图二" src="IndexImage/IMG_0075.JPG" /></a></div>
<div class="thumb_off" id="tmb2" onmouseover="setfoc(2);" onmouseout="playit();">
<a href="IndexImage/IMG_0076.JPG" target="_blank">
<img alt="图三" src="IndexImage/IMG_0076.JPG" /></a></div>
<div class="thumb_off" id="tmb3" onmouseover="setfoc(3);" onmouseout="playit();">
<a href="IndexImage/IMG_0078.JPG" target="_blank">
<img alt="图四" src="IndexImage/IMG_0078.JPG" /></a></div>
<div class="thumb_off" id="tmb4" onmouseover="setfoc(4);" onmouseout="playit();">
<a href="IndexImage/IMG_0079.JPG" target="_blank">
<img alt="图五" src="IndexImage/IMG_0079.JPG" /></a></div>
<script language="javascript" type="text/javascript">
var picarry = {};
var lnkarry = {};
var ttlarry = {};
picarry[0] = "IndexImage/IMG_0072.JPG";
lnkarry[0] = "IndexImage/IMG_0072.JPG";
ttlarry[0] = "图一";
picarry[1] = "IndexImage/IMG_0075.JPG";
lnkarry[1] = "IndexImage/IMG_0075.JPG";
ttlarry[1] = "图二";
picarry[2] = "IndexImage/IMG_0076.JPG";
lnkarry[2] = "IndexImage/IMG_0076.JPG";
ttlarry[2] = "图三";
picarry[3] = "IndexImage/IMG_0078.JPG";
lnkarry[3] = "IndexImage/IMG_0078.JPG";
ttlarry[3] = "图四";
picarry[4] = "IndexImage/IMG_0079.JPG";
lnkarry[4] = "IndexImage/IMG_0079.JPG";
ttlarry[4] = "图五"
</script>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
<div align="center">
<script type="text/javascript">
var currslid = 0;
var slidint;
function setfoc(id) {
document.getElementById("focpic").src = picarry[id];
document.getElementById("foclnk").href = lnkarry[id];
document.getElementById("foctitle").innerHTML = '<a href="' + lnkarry[id] + '" target="_blank">' + ttlarry[id] + '</a>';
currslid = id;
for (i = 0; i < 5; i++) {
document.getElementById("tmb" + i).className = "thumb_off";
};
document.getElementById("tmb" + id).className = "thumb_on";
focpic.style.visibility = "hidden";
focpic.filters[0].Apply();
if (focpic.style.visibility == "visible") {
focpic.style.visibility = "hidden";
focpic.filters.revealTrans.transition = 23;
}
else {
focpic.style.visibility = "visible";
focpic.filters[0].transition = 23;
}
focpic.filters[0].Play();
stopit();
} function playnext() {
if (currslid == 4) {
currslid = 0;
}
else {
currslid++;
};
setfoc(currslid);
playit();
}
function playit() {
slidint = setTimeout(playnext, 4500);
}
function stopit() {
clearTimeout(slidint);
}
window.onload = function () {
playit();
}</script>
</div>
A
{
text-decoration: none;
}
A:link
{
color: #505050;
}
A:visited
{
color: #505050;
}
A:hover
{
color: #d40005;
text-decoration: underline;
}
A:active
{
color: #f30;
}
IMG
{
border-top-width: 0px;
border-left-width: 0px;
border-bottom-width: 0px;
border-right-width: 0px;
}
.box
{
float: left;
width: 472px;
}
.box .boxpadding
{
padding-right: 8px;
padding-left: 8px;
margin-bottom: 0px;
padding-bottom: 8px;
padding-top: 8px;
}
#Slide
{
clear: both;
border-right: #fff 1px solid;
border-top: #fff 1px solid;
margin-bottom: 6px;
overflow: hidden;
border-left: #fff 1px solid;
width: 450px;
border-bottom: #fff 1px solid;
height: 335px;
}
#Slide A
{
color: #000;
}
.img
{
border-right: #fff 1px solid;
background: #fff;
margin: 0px auto;
border-left: #fff 1px solid;
text-align: center;
}
.boxpadding
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
background: #f8f8f8;
margin-bottom: 8px;
border-left: #fff 1px solid;
padding-top: 10px;
border-bottom: #fff 1px solid;
}
.thumb_title
{
margin-top: 10px;
background: #fff;
filter: alpha(opacity=30);
width: 450px;
text-indent: 10px;
line-height: 25px;
position: absolute;
height: 25px;
-moz-opacity: 0.3;
}
#Slide_Thumb
{
margin-top: 257px;
margin-left: 0px;
position: absolute;
}
.thumb_on
{
display: inline;
float: left;
margin-left: 8px;
cursor: pointer;
}
.thumb_off
{
display: inline;
float: left;
margin-left: 8px;
cursor: pointer;
}
.thumb_off
{
filter: alpha(opacity=50);
-moz-opacity: 0.5;
}
.thumb_on
{
filter: alpha(opacity=100);
-moz-opacity: 1;
}
.thumb_off IMG
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
margin-top: 12px;
border-left: #fff 1px solid;
width: 75px;
border-bottom: #fff 1px solid;
height: 56px;
}
.thumb_on IMG
{
border-right: #fff 1px solid;
border-top: #fff 1px solid;
border-left: #fff 1px solid;
width: 91px;
border-bottom: #fff 1px solid;
height: 68px;
}</style>
<table width="472" height="490" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="472">
<div class="box" style="margin-bottom: 8px">
<div class="boxpadding">
<div id="Slide">
<a id="foclnk" href="IndexImage/IMG_0072.JPG" target="_blank">
<img id="focpic" style="filter: RevealTrans(duration=1; ransition=12);
position: absolute; left: 484; top: 94" src="IndexImage/IMG_0072.JPG" width="450"
height="335" alt="" />
</a>
<div class="thumb_title" id="foctitle">
<a href="IndexImage/IMG_0072.JPG" target="_blank">图一</a></div>
<div id="Slide_Thumb">
<div class="thumb_on" id="tmb0" onmouseover="setfoc(0);" onmouseout="playit();">
<a href="
IndexImage/IMG_0072.JPG" target="_blank">
<img alt="图一" src="IndexImage/IMG_0072.JPG" /></a></div>
<div class="thumb_off" id="tmb1" onmouseover="setfoc(1);" onmouseout="playit();">
<a href="IndexImage/IMG_0075.JPG" target="_blank">
<img alt="图二" src="IndexImage/IMG_0075.JPG" /></a></div>
<div class="thumb_off" id="tmb2" onmouseover="setfoc(2);" onmouseout="playit();">
<a href="IndexImage/IMG_0076.JPG" target="_blank">
<img alt="图三" src="IndexImage/IMG_0076.JPG" /></a></div>
<div class="thumb_off" id="tmb3" onmouseover="setfoc(3);" onmouseout="playit();">
<a href="IndexImage/IMG_0078.JPG" target="_blank">
<img alt="图四" src="IndexImage/IMG_0078.JPG" /></a></div>
<div class="thumb_off" id="tmb4" onmouseover="setfoc(4);" onmouseout="playit();">
<a href="IndexImage/IMG_0079.JPG" target="_blank">
<img alt="图五" src="IndexImage/IMG_0079.JPG" /></a></div>
<script language="javascript" type="text/javascript">
var picarry = {};
var lnkarry = {};
var ttlarry = {};
picarry[0] = "IndexImage/IMG_0072.JPG";
lnkarry[0] = "IndexImage/IMG_0072.JPG";
ttlarry[0] = "图一";
picarry[1] = "IndexImage/IMG_0075.JPG";
lnkarry[1] = "IndexImage/IMG_0075.JPG";
ttlarry[1] = "图二";
picarry[2] = "IndexImage/IMG_0076.JPG";
lnkarry[2] = "IndexImage/IMG_0076.JPG";
ttlarry[2] = "图三";
picarry[3] = "IndexImage/IMG_0078.JPG";
lnkarry[3] = "IndexImage/IMG_0078.JPG";
ttlarry[3] = "图四";
picarry[4] = "IndexImage/IMG_0079.JPG";
lnkarry[4] = "IndexImage/IMG_0079.JPG";
ttlarry[4] = "图五"
</script>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
<div align="center">
<script type="text/javascript">
var currslid = 0;
var slidint;
function setfoc(id) {
document.getElementById("focpic").src = picarry[id];
document.getElementById("foclnk").href = lnkarry[id];
document.getElementById("foctitle").innerHTML = '<a href="' + lnkarry[id] + '" target="_blank">' + ttlarry[id] + '</a>';
currslid = id;
for (i = 0; i < 5; i++) {
document.getElementById("tmb" + i).className = "thumb_off";
};
document.getElementById("tmb" + id).className = "thumb_on";
focpic.style.visibility = "hidden";
focpic.filters[0].Apply();
if (focpic.style.visibility == "visible") {
focpic.style.visibility = "hidden";
focpic.filters.revealTrans.transition = 23;
}
else {
focpic.style.visibility = "visible";
focpic.filters[0].transition = 23;
}
focpic.filters[0].Play();
stopit();
} function playnext() {
if (currslid == 4) {
currslid = 0;
}
else {
currslid++;
};
setfoc(currslid);
playit();
}
function playit() {
slidint = setTimeout(playnext, 4500);
}
function stopit() {
clearTimeout(slidint);
}
window.onload = function () {
playit();
}</script>
</div>
解决方案 »
- jquery如何得到表格中不为某个class类型的总的行数
- 一个权限问题,和sql 问题 希望大哥们回答
- asp.net中如何自定义返回类型
- 问个笨问题啊。。。vs2005添加类引用怎么添加啊?
- 怎么实现文件的自动导入数据库,并建立日志文件,看该文件是否导入成功.导入之后把文件自动删除,不成功则不删除~~?有相关例子么?
- .NET怎么实现QQ菜单,而且数据是从数据库里读取的,有层次关系
- 请教专家,帮我看看下面代码!---急----在线等,谢谢
- 如何在DataGrid翻页前遍历DataGrid的Item[C#]
- ASP.NET中如何编写那些代碼
- 求助有效时间格式的正则表达式
- 如何提取flash中的图片
- GridView Asp.net查询
改成
var focpic = document.getElementById("focpic");
focpic.src = picarry[id];
大哥,可以的耶。谢谢你俄。但是我还是想问下为什么在 <form id="form1" runat="server"></form>下运行总是显示“Microsoft JScript 运行时错误: 'focpic' 未定义”,但在去掉<form id="form1" runat="server"></form>运行就不会出错呢。