这段JS代码怎么改 ?

lijun521 2005-01-07 02:27:29
http://www.blueidea.com/bbs/newsdetail.asp?lp=1&daysprune=5&id=1887129
这段JS代码怎么改
...全文
76 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
scoutlin 2005-01-07
  • 打赏
  • 举报
回复
或者改这行,将 CELLSPACING=0 cellpadding=0
可减少一些高度
var HTML_String = '<table><tr><td valign="top"><table BORDER=1 CELLSPACING=0 cellpadding=0 FRAME="box" BGCOLOR="f0f0f0" BORDERCOLOR="ffffff">';
scoutlin 2005-01-07
  • 打赏
  • 举报
回复
这么大的字
就注定了要这么大
如果要小
只能调字的大小
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, 宋体;
font-size: 8px;/*改成8,很小了*/
}
-->
</style>
lijun521 2005-01-07
  • 打赏
  • 举报
回复
太感谢了 那么这么控制高度啊 把我用PS做的页面撑破了!

急啊! 高度是134px
scoutlin 2005-01-07
  • 打赏
  • 举报
回复
太长了,分两节回复
其实只在这两个地方,加了display:none

<div id=NavBar style="position:relative;top:-1px;display:none">
<div id="Clock" style="position:relative;top:-2px;display:none"></div>
scoutlin 2005-01-07
  • 打赏
  • 举报
回复
function Skip(Direction) {
if (Direction == '+') {
if (Selected_Month == 11) {
Selected_Month = 0;
Selected_Year++;
}
else {
Selected_Month++;
}
}
else {
if (Selected_Month == 0) {
Selected_Month = 11;
Selected_Year--;
}
else {
Selected_Month--;
}
}
Make_Calendar(Selected_Year, Selected_Month);
document.when.month.selectedIndex = Selected_Month;
document.when.year.value = Selected_Year;
}

function tick() {
var hours, minutes, seconds, xfile;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "午夜 ";
} else if (intHours < 12) {
hours = intHours+":";
xfile = "上午 ";
} else if (intHours == 12) {
hours = "12:";
xfile = "正午 ";
} else {
intHours = intHours - 12
hours = intHours + ":";
xfile = "下午 ";
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = xfile+hours+minutes+seconds;
document.all.Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}

//-->
</script>
<body onLoad="Defaults();tick()" >

<form name="when">
<div id=NavBar style="position:relative;top:-1px;display:none">
<br>
<select name="month" onChange="On_Month()" style="border: 1 solid #C0C0C0" size="1">
<script language="JavaScript1.2">
<!--
if (document.all){
for (j=0;j<Month_Label.length;j++) {
document.writeln('<option value=' + j + '>' + Month_Label[j]);
}
}
//-->
</script>
</select>
<input type="text" name="year" size=4 maxlength=4 onKeyPress="return Check_Nums()" onKeyUp="On_Year()" style="border: 1 solid #C0C0C0"><br>
<div id="Clock" style="position:relative;top:-2px;display:none"></div>
</div>
<div id=Calendar style="position:relative;top:-3px;"></div>
</form>

</body>
</html>
scoutlin 2005-01-07
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, 宋体;
font-size: 12px;
}
-->
</style></head>



<script language="JavaScript">
<!--
var Selected_Month;
var Selected_Year;
var Current_Date = new Date();
var Current_Month = Current_Date.getMonth();

var Days_in_Month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var Month_Label = new Array('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月');

var Current_Year = Current_Date.getYear();

var Today = Current_Date.getDate();

function Header(Year, Month) {

if (Month == 1) {
if ((Year % 400 == 0) || ((Year % 4 == 0) && (Year % 100 != 0))) {
Days_in_Month[1] = 29;
}
}
var Header_String = Year + '年' + Month_Label[Month];
return Header_String;
}



function Make_Calendar(Year, Month) {
var First_Date = new Date(Year, Month, 1);
var Heading = Header(Year, Month);
var First_Day = First_Date.getDay() + 1;
if (((Days_in_Month[Month] == 31) && (First_Day >= 6)) ||
((Days_in_Month[Month] == 30) && (First_Day == 7))) {
var Rows = 6;
}
else if ((Days_in_Month[Month] == 28) && (First_Day == 1)) {
var Rows = 4;
}
else {
var Rows = 5;
}

var HTML_String = '<table><tr><td valign="top"><table BORDER=1 CELLSPACING=1 cellpadding=2 FRAME="box" BGCOLOR="f0f0f0" BORDERCOLOR="ffffff">';

HTML_String += '<tr><th colspan=7 BGCOLOR="f0f0f0" BORDERCOLOR="ffffff">'+ Heading + '</font></th></tr>';

HTML_String += '<tr><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff"><font color="ff0000">日</font></th><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff">一</th><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff">二</th><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff">三</th>';

HTML_String += '<th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff">四</th><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff">五</th><th ALIGN="CENTER" BGCOLOR="e0f0f0" BORDERCOLOR="ffffff"><font color="007f00">六</font></th></tr>';

var Day_Counter = 1;
var Loop_Counter = 1;
for (var j = 1; j <= Rows; j++) {
HTML_String += '<tr ALIGN="left" VALIGN="top">';
for (var i = 1; i < 8; i++) {
if ((Loop_Counter >= First_Day) && (Day_Counter <= Days_in_Month[Month])) {
if ((Day_Counter == Today) && (Year == Current_Year) && (Month == Current_Month)) {
HTML_String += '<td BGCOLOR="F0F0F0" BORDERCOLOR="ffffff"><strong><font color="red">' + Day_Counter + '</font></strong></td>';
}
else {
HTML_String += '<td BGCOLOR="F0F0F0" BORDERCOLOR="ffffff">' + Day_Counter + '</td>';
}
Day_Counter++;
}
else {
HTML_String += '<td BORDERCOLOR="ffffff"> </td>';
}
Loop_Counter++;
}
HTML_String += '</tr>';
}
HTML_String += '</table></td></tr></table>';
document.all.Calendar.innerHTML = HTML_String;
}


function Check_Nums() {
if ((event.keyCode < 48) || (event.keyCode > 57)) {
return false;
}
}



function On_Year() {
var Year = document.when.year.value;
if (Year.length == 4) {
Selected_Month = document.when.month.selectedIndex;
Selected_Year = Year;
Make_Calendar(Selected_Year, Selected_Month);
}
}

function On_Month() {
var Year = document.when.year.value;
if (Year.length == 4) {
Selected_Month = document.when.month.selectedIndex;
Selected_Year = Year;
Make_Calendar(Selected_Year, Selected_Month);
}
else {
alert('Please enter a valid year.');
document.when.year.focus();
}
}


function Defaults() {
if (!document.all)
return
var Mid_Screen = Math.round(document.body.clientWidth / 2);
document.when.month.selectedIndex = Current_Month;
document.when.year.value = Current_Year;
Selected_Month = Current_Month;
Selected_Year = Current_Year;
Make_Calendar(Current_Year, Current_Month);
}




28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧