Thu

05

Mar

2009

147、自动生成问题回答页面

147、自动生成问题回答页面

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE = "JavaScript">

function uncode() {

smut="<";

changerz="< ";

textz=document.mail.source2.value;

tstx="";

space=changerz.indexOf(" ");

word=changerz.substring(0,space);

wordl=word.length

changerz=changerz.substring(space+1,changerz.length);

while (textz.indexOf(word)>-1){

space=textz.indexOf(word);

textz=textz.substring(0,space)+smut+textz.substring((space+wordl),textz.length);}

smut=">";

changerz="> ";

space=changerz.indexOf(" ");

word=changerz.substring(0,space);

wordl=word.length

changerz=changerz.substring(space+1,changerz.length);

while (textz.indexOf(word)>-1){

space=textz.indexOf(word);

textz=textz.substring(0,space)+smut+textz.substring((space+wordl),textz.length);}

document.mail.source2.value=textz;}

</script>

<SCRIPT LANGUAGE="JavaScript">

function go(form) {

var textz = '<html>\r\n' + '<body >\r\n\r\n'

+ '<SCR' + 'IPT LANG' + 'UAGE="JavaS' + 'cript">\r\n'

+ 'func' + 'tion show' + 'FAQ(form) ' + '{\r\n'

+ 'form.' + 'answer.value = form.' + 'question.options[form.question.'

+ 'selectedIndex].value;\r\n' + '}\r\n'

+ '</SCR' + 'IPT>\r\n'

+ '<center>\r\n<fo' + 'rm name=faqform>\r\n'

+ '<table border=1 cellspacing=0 cellpadding=5>\r\n';

if (document.faqgen.faqtitle.value != "") {

textz = textz + '<tr >\t\n<td align=center><font size="-1" '

+ 'color="black">\r\n<b>' + document.faqgen.faqtitle.value + '</b></font></td>\r\n</tr>\r\n';

}

textz = textz + '<tr ><td><center><font size="-1"><br>\r\n<p>'

+ '<select size=10 name=question onChange="java' + 'script:showFAQ(this.form);">\r\n'

+ '<option>\r\n' + '>>> >>> >>>\r\n' + '请选择一个问题\r\n' + '<<< <<< <<<\r\n' + '</option>\r\n'

+ '<option>\r\n'

+ '------------------------------------------------------------------------------------------------\r\n'

+ '</option>\r\n'

;

for (var i = 1; i <= 10; i++) {

q = eval('document.faqgen.q' + i + '.value');

a = eval('document.faqgen.a' + i + '.value');

if (q!="" && a!="") {

textz = textz + '<option value="' + a + '">   -->  ' + q + '\r\n';

}

else {

break;

}

}

textz = textz + '</select>\r\n'

+ '<p>\r\n'

+ '<textarea '

+ 'name="answer" rows=15 cols=50 wrap=virtual></textarea'

+ '>\r\n'

+ '</font></center>\r\n'

+ '</td>\r\n'

+ '</tr>\r\n'

+ '</table>\r\n'

+ '</form>\r\n'

+ '</center>\r\n\r\n</body>\r\n</html>';

document.mail.source.value=textz;

document.mail.source2.value=textz;

uncode();

}

function make(text) {

msg=window.open("","DisplayWindow");

msg.document.write(text);

}

</SCRIPT>

<form name=faqgen>

<table border=3 cellpadding="2" cellspacing="0" >

<tr >

<td colspan=2 >

                <h2 align="center">自动生成带问题回答的页面</h2>

</td>

</tr>

<tr>

              <td colspan=2 align=center> <b> </b> <b>

                <input type=text name=faqtitle size=25 value="页面的台头显示">

                </b></td>

</tr>

<tr align=center>

              <td colspan=2 align=center > <b>问题 & 回答</b></td>

</tr>

<tr align=center>

<td> <b>问题 1</b><br>

<textarea name=q1 rows=2 cols=30>问题 1</textarea>

              </td>

<td> <b>回答 1</b><br>

<textarea name=a1 rows=2 cols=30>回答 1</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 2</b><br>

<textarea name=q2 rows=2 cols=30>问题 2</textarea>

              </td>

<td> <b>回答 2</b><br>

<textarea name=a2 rows=2 cols=30>回答 2</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 3</b><br>

<textarea name=q3 rows=2 cols=30>问题 3</textarea>

              </td>

<td> <b>回答 3</b><br>

<textarea name=a3 rows=2 cols=30>回答 3</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 4</b><br>

<textarea name=q4 rows=2 cols=30>问题 4</textarea>

              </td>

<td> <b>回答 4</b><br>

<textarea name=a4 rows=2 cols=30>回答 4</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 5</b><br>

<textarea name=q5 rows=2 cols=30>问题 5</textarea>

              </td>

<td> <b>回答 5</b><br>

<textarea name=a5 rows=2 cols=30>回答 5</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 6</b><br>

<textarea name=q6 rows=2 cols=30>问题 6</textarea>

              </td>

<td> <b>回答 6</b><br>

<textarea name=a6 rows=2 cols=30>回答 6</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 7</b><br>

<textarea name=q7 rows=2 cols=30>问题 7</textarea>

              </td>

<td> <b>回答 7</b><br>

<textarea name=a7 rows=2 cols=30>回答 7</textarea>

              </td>

</tr>

<tr align=center>

<td> <b>问题 8</b><br>

<textarea name=q8 rows=2 cols=30>问题 8</textarea>

              </td>

<td> <b>回答 8</b><br>

<textarea name=a8 rows=2 cols=30>回答 8</textarea>

              </td>

</tr>

<tr align=center>

              <td> <b>问题 9</b><font color="#CCFFFF"><br>

                <textarea name=q9 rows=2 cols=30>问题 9</textarea>

                </font></td>

              <td> <b>回答 9</b><font color="#CCFFFF"><br>

              <textarea name=a9 rows=2 cols=30>回答 9</textarea>

                </font></td>

</tr>

<tr align=center>

              <td> <b>问题 10</b><font color="#CCFFFF"><br>

                <textarea name=q10 rows=2 cols=30>问题 10</textarea>

                </font></td>

              <td> <b>回答 10</b><font color="#CCFFFF"><br>

                <textarea name=a10 rows=2 cols=30>回答 10</textarea>

                </font></td>

</tr>

<tr>

<td colspan=2 align=center height=33>

<input type=button value="创建代码" onClick="go(this.form)">

<input type=reset value="重置">

</td>

</tr>

</table>

<br>

</form>

</center>

<p>

<center>

<form name="mail" action="" method="POST">

<input type=hidden name=scriptname value="FAQs Maker">

<table  border="3" cellpadding="2" width=400 cellspacing="0">

<tr>

<td align=center>

<input type="button" class="button" value="请看演示" name="Preview" onClick="make(this.form.source.value);">

<p>

<textarea name="source" rows=12 cols=80></textarea>

<br>

<input type="hidden" name="source2">

</td>

</tr>

</table>

</form>

 

0 Comments

Thu

05

Mar

2009

146、下拉菜单自动生成

146、下拉菜单自动生成

脚本说明:

第一步:把如下代码加入<body>区域中

<script language="javascript">

// Location of this script:

// http://www.qiksearch.com/javascripts/menugen.htm

 

var no_options;

 

document.write('<table cellspacing="5" cellpadding="5" style="border:2 solid #808080" align="center"><tr><td>');

document.write('<form name="qiksearch">');

if(navigator.appName=="Microsoft Internet Explorer")

{

 document.write('<font face="verdana,arial,helvetica" size="-1" color="#000000">显示<select name="select_items" onchange="javascript:showItems(this.document.qiksearch.select_items.value)" style="font-size:8pt">');

 for(var i=1; i<=30; i++)

 {

  document.write('<option value="' + i + '">' + i + '</option>');

 }

 this.document.qiksearch.select_items.selectedIndex = 4;

 document.write('</select> 链接.<br><br>');

}

 

document.write('<b>下拉菜单名称:</b><br><br>');

document.write('<input type="text" value="Select" name="combo_caption" size="30" style="height:20; border:1 solid #000000">');

document.write('<br><br><b>下拉菜单内容 :</b><br><br>');

document.write('<div id="items">');

for(var i=1; i<=5; i++)

{

 document.write('Option : <input type="text" size="12" name="option' + i + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + i + '" size="15" style="height:20; border:1 solid #000000"><br>');

}

document.write('</div>');

document.write('<br><center><input type="button" name="qiksearch_submit" value="显示代码" onclick="display()" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"> <input type="reset" onclick="javascript:location.reload();" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"></center>');

document.write('</font></form>');

 

document.write('</td></tr></table>');

 

function showItems(n)

{

 var item_disp = "";

 for(var i=0; i<n; i++)

 {

  item_disp += 'Option : <input type="text" size="12" name="option' + (i+1) + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + (i+1) + '" size="15" style="height:20; border:1 solid #000000"><br>';

 }

 no_options=n;

 this.document.all.items.innerHTML = item_disp;

}

 

if(navigator.appName=="Microsoft Internet Explorer")

{

 no_options = this.document.qiksearch.select_items.value;

}

else

{

 no_options = 5;

}

 

function display() {

   DispWin=window.open('','NewWin',

   'toolbar=no,status=no,width=500,height=375')

   message="<font face=arial,verdana,helvetica size=-2 color=#000000><b><!--Made with Qiksearch MenuGen-->";

   message += "<br><script language="javascript" type="text/javascript">";

   message += "<br>function go()";

   message += "<br>{";

   message += "<br> if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != "none")";

   message += "<br> {";

   message += "<br>  location = document.selecter.select1.options[document.selecter.select1.selectedIndex].value";

   message += "<br> }";

   message += "<br>}";

   message += "<br></script>";

   message += "<br>";

   message += "<br><script language="JavaScript" type="text/javascript">";

   message += "<br>document.write('<form name="selecter"><select name="select1">');";

   message += "<br>document.write('<option value=none>" + this.document.qiksearch.combo_caption.value + "</option>');";

   message += "<br>document.write('<option value=none>--------------------</option>');";

    for(var i=1; i<=no_options; i++)

    {

     message += "<br>document.write('<option value="" + eval('this.document.qiksearch.linkto' + i + '.value') + "">" + eval('this.document.qiksearch.option' + i + '.value') + "</option>');";

    }

   message += "<br>document.write('</select>');";

   message += "<br>document.write('<input type="button" value="Go" onclick="go()">');";

   message += "<br>document.write('</form>');";

   message += "<br></script>";

  

   DispWin.document.write(message);

}

 

 

</script>

 

第二步:把<body>中的内容改为:

<body bgcolor="#fef4d9" onload="this.document.qiksearch.select_items.selectedIndex = 4">

 

0 Comments

Thu

05

Mar

2009

145、变色代码生成程序

145、变色代码生成程序

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function randomise(){

var words=document.myform.wordlist.value;

var spacer="";

words=words.split(document.myform.randomiseby.options[document.myform.randomiseby.selectedIndex].value)

document.myform.code.value="";

var colourscheme=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F")

for(var time=0;time<=(words.length-1);time++){

if(words[time]==" "){document.myform.code.value+=" "}

if(words[time]!=" "){

spacer=document.myform.randomiseby.options[document.myform.randomiseby.selectedIndex].value;

var c1=Math.round(Math.random()*(colourscheme.length-1));

var c2=Math.round(Math.random()*(colourscheme.length-1));

var c3=Math.round(Math.random()*(colourscheme.length-1));

var c4=Math.round(Math.random()*(colourscheme.length-1));

var c5=Math.round(Math.random()*(colourscheme.length-1));

var c6=Math.round(Math.random()*(colourscheme.length-1));

var size=1+Math.round(Math.random()*6);

document.myform.code.value+="<font color=\"#"+colourscheme[c1]+colourscheme[c2]+colourscheme[c3]+colourscheme[c4]+colourscheme[c5]+colourscheme[c6]+"\" size=\""+size+"\">"+words[time]+"</font>"+spacer+"";

}

}

looks_like.innerHTML=document.myform.code.value;

}

//  End -->

</script>

<div align="center">

<form name="myform" action="javascript:randomise()">

<input name="wordlist" value="Welcome to jzzy thank you I love javascript very much" size="50">

<br>

<select name="randomiseby">

<option value="">按字符变化</option>

<option value=" ">按单词变化</option>

</select><br><br>

<input type="submit" value="Do it">

<br><br>

<span id="looks_like"></span>

<br><br>

<textarea name="code" rows="5" cols="50">

 

0 Comments

Thu

05

Mar

2009

144、QQ菜单生成器

144QQ菜单生成器

脚本说明:

把如下代码加入<body>区域中

<!--版权归flashsoft2000所有,但copy不究-->

<html>

<head>

<title>CreateCode</title>

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

<script language="javascript">

//生成代码

function createCode()

{

       totalheight = parseInt(fcreate.bodyheight.value) + fcreate.headheight.value * (fcreate.itemcount.value - 1);

       textCode.value = text1.value +

              "var headHeight = " + fcreate.headheight.value + ";" +

              "var bodyHeight = " + fcreate.bodyheight.value + ";" +

              "var objcount = " + fcreate.itemcount.value + ";" +

              "var step = " + fcreate.mspeed.value + ";" +

              text2.value +

              ".headtd1 {  background: #" + fcreate.headcolorn.value + "; border: 2px outset; border-color: #" + fcreate.lbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.lbordern.value + "; cursor: hand; font-size: 9pt}" +

              ".headtd2 {  background: #" + fcreate.headcolora.value + "; border: 2px outset; border-color: #" + fcreate.lbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.lbordera.value + "; cursor: hand; font-size: 9pt}" +

              ".bodytd  {  background: #" + fcreate.bodycolor.value + "; border: 2px outset; border-color: #" + fcreate.lborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.lborderb.value + "; font-size: 9pt}" +

              text3.value +

              "<div id='mainboard' style='position:absolute; left:2px; top:2px; width:120px; height:" + totalheight + "px; z-index:1; overflow: hidden; background: #" + fcreate.bodycolor.value + ";'> ";

 

       itemtop = 0;

       for (i = 1; i <= parseInt(fcreate.itemcount.value); i++)

       {

              textCode.value += "<div id='item" + i + "body' style='position:absolute; left:0; top:" + itemtop + "; width:120px; height:" + fcreate.bodyheight.value + "px; z-index:" + (i+1) +"; overflow: hidden'>" +

              "<table width='100%' border='0' height='100%' cellpadding='2' cellspacing='0'>" +

              "<tr>" +

       "<td id='item" + i + "head' height='" + (fcreate.headheight.value-2) + "' class=";

if (i == 1)

       textCode.value += "'headtd2'";

else textCode.value += "'headtd1'";

textCode.value += " onclick='showme(item" + i + "body,this)' align='center'>";

//textCode.value += getValue("fcreate.item" + i);

textCode.value +=document.all["item"+i].value+"</td>"+

              "</tr>" +

              "<tr>" +

       "<td class='bodytd' align='center'>" +

       "test" +

       "</td>" +

              "</tr>" +

                     "</table>" +

                     "</div>";

              if (i == 1)

                     itemtop += parseInt(fcreate.bodyheight.value);

              else itemtop += parseInt(fcreate.headheight.value);

       }

       textCode.value += "</div></body></html>"

}

//获取对象的值

function getValue(obj)

{

       //obj = Object(obj);

       return obj.value;

}

//清空代码

function clearCode()

{

       textCode.value = "";

}

//预览代码

function prevCode()

{

       createCode();

       open().document.write(textCode.value);

}

//选择代码

function selectCode()

{

       textCode.select();

}

//根据输入的数字,自动生成子菜单的填写项

function checkItems()

{

       if ((fcreate.itemcount.value.length > 0 && isNaN(fcreate.itemcount.value)) || fcreate.itemcount.value.length == 0)

       {

              alert("请输入数字!");

              fcreate.itemcount.focus();

       }

       else

       {

              if (fcreate.itemcount.value > 50)

              {

                     alert("太夸张了吧,小一点呀,不用这么玩命吧!(50以下,含50")

                     fcreate.itemcount.focus();

                     return;

              }

              if (fcreate.itemcount.value < 1)

              {

                     alert("太夸张了吧,一个不要你要做什么!(1以上,含1")

                     fcreate.itemcount.focus();

                     return;

              }

              itemtext = "<table width='700' border='0' align='center' cellpadding='1' cellspacing='1'>";

              for (i = 1; i <= fcreate.itemcount.value; i++)

              {

 

                     itemtext += "<tr>"+

                            "<td class='td2' width='76'>菜单项目"+i+"</td>" +

                            "<td colspan='2' class='td2'>" +

                     "      <input type='text' name='item" + i + "' class='back2' style='width:200' value='菜单" + i + "'>" +

                            "</td>" +

                            "<td class='td2' width='173'>       </td>" +

                            "<td colspan='2' class='td2'>" +

                     "      <input type='file' name='itemsrc" + i + "' class='back2' style='width:200'>" +

                            "</td>" +

                            "</tr>";

              }

              itemtext+="</table>"

              document.all.itemmenu.innerHTML = itemtext;

       }

}

//检查是否是一个合法的颜色数值

function changebkclr(obj)

{

       hexv = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");

       flag = false;

       if (obj.value.length != 6)

       {

              alert("请用正确填写!(六位数)");

              obj.focus();

       }

       else

       {

              for (i = 0; i < 6; i++)

              {

                     for (j = 0; j <16; j++)

                            if (obj.value.charAt(i).toLowerCase() == hexv[j])

                                   flag = true;

                     if (!flag)

                     {

                            alert("请用十六进制填写。(0-9a-f");

                            obj.focus();

                            return;

                     }

                     flag = false;

              }

              obj.style.background=obj.value;

       }

}

//检查是否是一个合法的数字

function checknum(obj)

{

       if (isNaN(obj.value))

       {

              alert("请输入数字!");

              obj.focus();

              return;

       }

}

//检查改变数值的速度合法性

function changespd(obj)

{

       fcreate.mspeed.value = 1;

}

//检查是否是一个合法的速度

function checkspeed(obj)

{

       if (isNaN(obj.value))

       {

              alert("请输入数字!");

              obj.focus();

       }

       else

       {

              if ((obj.form.bodyheight.value - obj.form.headheight.value)%obj.value != 0)

              {

                     alert("请确认可以被 “菜单体高度 - 菜单题头高度” 整除");

                     obj.focus();

              }

       }

}

//控制总题目的填写

function ctrltitle(obj)

{

       if (obj.value == "")

              obj.form.titlename.disabled = false;

       else

              obj.form.titlename.disabled = true;

}

</script>

<style type="text/css">

<!--

.td1{  font-size: 9pt; background: #66CCFF}

.td2{  font-size: 9pt; background: #66aaFF}

.back1 {  font-size: 9pt; width:100}

.back2 {  font-size: 9pt; background: #BECFEE}

-->

</style>

</head>

 

<body bgcolor='#FFFFFF' text='#000000'>

<div align="center">

      <textarea name="textCode" rows="28" style="width:700" class="back2" readonly><</textarea>

  <br>

  <input type="button" name="btnCreate" value="<- 生成代码 (ALT+M)" class="back2" style="width:150" onclick="createCode()" accessKey="m">

  <input type="button" name="btnClear" value="#= 清空代码 (ALT+C)" class="back2" style="width:150" onclick="clearCode()" accessKey="c">

  <input type="button" name="btnPrev" value="O- 预览效果 (ALT+P)" class="back2" style="width:150" onclick="prevCode()" accessKey="p">

  <input type="button" name="btnSelect" value="@@ 全选代码 (ALT+A)" class="back2" style="width:150" onclick="selectCode()" accessKey="a">

</div>

<form name="fcreate" method="post" action="">

  <table width="700" border="0" align="center" cellpadding="2" cellspacing="1">

    <tr>

      <td class="td1" width="13%" height="13">菜单项目个数</td>

      <td class="td1" width="12%" height="13">

        <input type="text" name="itemcount" style="width:40" class="back2" onblur="checkItems()" value="2">

      </td>

      <td class="td1" width="13%" height="13">菜单题头高度</td>

      <td class="td1" width="12%" height="13">

        <input type="text" name="headheight" class="back2" value="22" style="width:50" onblur="checknum(this)" onchange="checkspeed(fcreate.mspeed)">

      </td>

      <td class="td1" width="13%" height="13">菜单体高度</td>

      <td class="td1" width="12%" height="13">

        <input type="text" name="bodyheight" class="back2" value="202" style="width:50" onblur="checknum(this)" onchange="checkspeed(fcreate.mspeed)">

      </td>

      <td class="td1" width="13%" height="13">填写移动速度</td>

      <td class="td1" width="12%" height="13">

        <input type="text" name="mspeed" class="back2" value="10" style="width:50" onblur="checkspeed(this)">

      </td>

    </tr>

    <tr>

      <td class="td1" colspan="8" height="55">

        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" dwcopytype="CopyTableRow">

          <tr>

            <td class="td1" width="16%">

            <td class="td1" width="20%"> </td>

              <input type="text" name="headcolorn" class="back1" style="background:#00A4E1" value="00A4E1" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td class="td1" width="16%"> </td>

            <td class="td1" width="16%">

              <input type="text" name="lbordern" class="back1" style="background:#00BBFF" value="00BBFF" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td class="td1" width="16%"> </td>

            <td class="td1" width="16%">

              <input type="text" name="dbordern" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)" maxlength="6">

            </td>

          </tr>

          <tr>

            <td class="td1" width="20%"> </td>

 

            <td class="td1" width="16%">

              <input type="text" name="headcolora" class="back1" style="background:#20C1FF" value="20C1FF" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td width="16%"  class="td1"> </td>

            <td  class="td1" width="16%">

              <input type="text" name="lbordera" class="back1" style="background:#60D3FF" value="60D3FF" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td  class="td1" width="16%"> </td>

            <td  class="td1" width="16%">

              <input type="text" name="dbordera" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)" maxlength="6">

            </td>

          </tr>

          <tr>

            <td class="td1" width="20%"> </td>

            <td class="td1" width="16%">

              <input type="text" name="bodycolor" class="back1" style="background:#99CCFF" value="99CCFF" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td width="16%"  class="td1"> </td>

            <td  class="td1" width="16%">

              <input type="text" name="lborderb" class="back1" style="background:#B0D8FF" value="B0D8FF" onblur="changebkclr(this)" maxlength="6">

            </td>

            <td  class="td1" width="16%"> </td>

            <td  class="td1" width="16%">

              <input type="text" name="dborderb" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)">

            </td>

          </tr>

        </table>

      </td>

    </tr>

    <tr>

      <td class="td1" width="80">菜单  总题目</td>

      <td class="td1" width="85">

        <select name="title" style="width:40" class="back2" onchange="ctrltitle(this)">

          <option value=""></option>

          <option value="" selected></option>

        </select>

      </td>

      <td width="95"  class="td1">题目名称</td>

      <td colspan="5"  class="td1">

        <input type="text" name="titlename" class="back2" value="填写总题目" disabled>

      </td>

    </tr>

  </table>

       <div id="itemmenu">

      <table width='700' border='0' align='center' cellpadding='1' cellspacing='1'>

           <tr>

             <td class='td2' width='76'>菜单项目1</td>

             <td colspan='2' class='td2'>

                  <input type='text' name='item1' class='back2' style='width:200' value="菜单1">

             </td>

             <td class='td2' width='173'>       </td><td colspan='2' class='td2'>

                  <input type='file' name='itemsrc1' class='back2' style='width:200'>

             </td>

           </tr>

           <tr>

             <td class='td2' width='76'>菜单项目2</td>

             <td colspan='2' class='td2'>

                  <input type='text' name='item2' class='back2' style='width:200' value="菜单2">

             </td>

             <td class='td2' width='173'>       </td><td colspan='2' class='td2'>

                  <input type='file' name='itemsrc2' class='back2' style='width:200'>

             </td>

           </tr>

    </table>

    </div>

</form>

<div style="display:none">

<textarea name="text1" rows="5" style="width:700" class="back1" readonly>

<html>

<head>

<title>QQ菜单</title>

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

<script language='JavaScript'>

</textarea>

<textarea name="text2" rows="5" style="width:700" class="back1" readonly>

var moving = false;

function showme(obj1, obj2)

{

       if (moving)

              return;

       moving = true;

       for(i=0;i<document.all.tags('td').length;i++)

              if (document.all.tags('td')[i].className.indexOf('headtd') == 0)

                     document.all.tags('td')[i].className = 'headtd1';

       obj2.className = 'headtd2';

       moveme(obj1);

}

function moveme(obj)

{

       idnumber = parseInt(obj.id.substr(4));

       objtop = headHeight * (idnumber - 1);

       objbuttom = bodyHeight + headHeight * (idnumber - 2);

       currenttop = parseInt(obj.style.top);

       if (currenttop >= objbuttom)

       {

              countid = 1;

              for(i=0;i<document.all.tags('div').length;i++)

                     if (document.all.tags('div')[i].id == 'item'+countid+'body')

                     {

                            obj = document.all.tags('div')[i];

                            objtop = headHeight * (countid - 1);

                            if (countid == idnumber)

                            {

                                   moveup(obj,objtop,false);

                                   break;

                            }

                            else

                                   moveup(obj,objtop,true);

                            countid++;

                     }

       }

       else if ((currenttop <= objtop) && (idnumber < objcount))

       {

              idnumber++;

              countid = objcount;

              for(i=document.all.tags('div').length-1;i>=0;i--)

                     if (document.all.tags('div')[i].id == 'item'+countid+'body')

                     {

                            obj = document.all.tags('div')[i];

                            objbuttom = bodyHeight + headHeight * (countid - 2);

                            if (countid == idnumber)

                            {

                                   movedown(obj,objbuttom,false);

                                   break;

                            }

                            else

                                   movedown(obj,objbuttom,true);

                            countid--;

                     }

       }

}

function moveup(obj,objtop,ismove)

{

       currenttop = parseInt(obj.style.top);

       if (currenttop > objtop)

       {

              obj.style.top = currenttop - step;

              setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1)

              return;

       }

       moving = ismove;

}

function movedown(obj,objbuttom,ismove)

{

       currenttop = parseInt(obj.style.top);

       if (currenttop < objbuttom)

       {

              obj.style.top = currenttop + step;

              setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1)

              return;

       }

       moving = ismove;

}

</script>

</script>

<style type='text/css'>

</textarea>

<textarea name="text3" rows="5" style="width:700" class="back1" readonly>

 

</style>

</head>

<body bgcolor='#FFFFFF' text='#000000'>

</textarea>

</div>

</body>

</html>

 

1 Comments

Thu

05

Mar

2009

143、javascript代码自动生

143javascript代码自动生

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language=JavaScript>

<!--

function fillit() {

 if (document.codeForm.all("style").item(0).checked==true) style="1";

 else if (document.codeForm.all("style").item(1).checked==true) style="2";

 else if (document.codeForm.all("style").item(2).checked==true) style="3";

else if (document.codeForm.all("style").item(3).checked==true) style="4";

else { alert("你还没有选择文本链的样式!"); return false; }

 if (document.codeForm.all("color").item(0).checked==true) color="#CCCCCC";

 else if (document.codeForm.all("color").item(1).checked==true) color="FFCC00";

 else if (document.codeForm.all("color").item(2).checked==true) color="99CC00";

 else if (document.codeForm.all("color").item(3).checked==true) color="FF99FF";

else if (document.codeForm.all("color").item(4).checked==true) color="00CCFF";

else if (document.codeForm.all("color").item(5).checked==true) color="FF6600";

 else if (document.codeForm.all("color").item(6).checked==true) color="CCCC99";

 else if (document.codeForm.all("color").item(7).checked==true) color="auto";

else if (document.codeForm.all("color").item(8).checked==true) {

if (document.codeForm.diycolor.value.length < 7)  { alert("如果选择了自定义颜色,必须在后面的编辑框填入正确的颜色代码!\n(颜色代码为标准代码,7位字符,例如#ABCDEF)"); return false; }

 else color=document.codeForm.diycolor.value;

 }

else { alert("你还没有选择文本链的颜色!"); return false; }

document.codeForm.code.value="<script language=\"JavaScript\" src=\"http://www.k688.com/show"+ style +".php?id="+document.codeForm.id.value + "&c=" + color +"\"></script>";

return false;

}

-->

</SCRIPT>

<FORM name=codeForm>

<TABLE cellSpacing=0 cellPadding=0 width=600 align=center border=0>

  <TBODY>

  <TR>

    <TD bgColor=#0093dd colSpan=2><FONT color=#ffffff>·获取代码 <INPUT

      type=hidden value=jzzy name=id> </FONT></TD></TR>

  <TR>

    <TD colSpan=2 height=30>选择文本链规格: <INPUT type=radio value=1 name=style>

      12X1列  <INPUT type=radio value=2 name=style> 3X4列  <INPUT type=radio

      value=3 name=style> 3X6列  <INPUT type=radio value=4 name=style>

      自动弹出式的7X4</TD></TR>

  <TR>

    <TD bgColor=#0093dd colSpan=2><IMG height=1 src="4.files/1.gif" width=1

      border=0></TD></TR>

  <TR>

    <TD colSpan=2 height=90>选择文本链颜色: <INPUT type=radio value=#CCCCCC

      name=color> <FONT color=#cccccc>██</FONT>  <INPUT type=radio value=#FFCC00

      name=color> <FONT color=#ffcc00>██</FONT>  <INPUT type=radio value=#99CC00

      name=color> <FONT color=#99cc00>██</FONT>  <INPUT type=radio value=#FF99FF

      name=color> <FONT color=#ff99ff>██</FONT>  <INPUT type=radio value=#00CCFF

      name=color> <FONT color=#00ccff>██</FONT>  <INPUT type=radio value=#FF6600

      name=color> <FONT color=#ff6600>██</FONT>  <INPUT type=radio value=#CCCC99

      name=color> <FONT color=#cccc99>██</FONT><BR>         <INPUT type=radio

      value=AUTO name=color> 使用自动轮换的颜色 <BR>         <INPUT type=radio value=DIY

      name=color> 自定义颜色 <INPUT maxLength=7 size=10 name=diycolor> </TD></TR>

  <TR>

    <TD bgColor=#0093dd colSpan=2><IMG height=1 src="4.files/1.gif" width=1

      border=0></TD></TR>

  <TR>

    <TD colSpan=2 height=30>以上内容选择好后,请点按钮即可在下面生成代码 <INPUT onclick="javascript:fillit();return false" type=button value=生成代码 name=Submit>

    </TD></TR>

  <TR>

    <TD bgColor=#0093dd colSpan=2><IMG height=1 src="4.files/1.gif" width=1

      border=0></TD></TR>

  <TR>

    <TD colSpan=2 height=120>文本链代码:<BR><TEXTAREA class=p12 name=code rows=5 cols=82>

 

0 Comments

Thu

05

Mar

2009

142、分割Frame的代码

142、分割Frame的代码

脚本说明:

把如下代码加入<body>区域中

<SCRIPT language="Javascript">

 

var top="<HTML>" + "\r" + "<TITLE>My Frame Page</TITLE>" + "\r" +"<HEAD></HEAD>"

var nf="<noframes>" + "\r" + "You need a frames capable browser to view this page."       + "\r" + "</noframes>" + "\r" + "</HTML>"

var f="</frameset>"

var bc="bordercolor=blue>"

var MW="marginwidth=0"

var MH="marginheight=0"

 

function framesa() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=50%,* "

+ " " + bc + "\r" + "<frame src=1.htm" +" " + "name=One"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + "<frame src=2.htm" +" " + "name=Two"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framesb() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset rows=50%,* "

+ " " + bc + "\r" + "<frame src=1.htm" +" " + "name=One"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + "<frame src=2.htm" +" " + "name=Two"

+ "\r" + "scrolling=auto" + " " + MW + " " + MH + " " +  "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framemixa() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=30%,* " + bc + " " + "noresize=yes>"

+ "\r" + "<frame src=1.htm" + " " + "name=One" + " " + "scrolling=yes"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frameset rows=50%,*>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + MW

+ "\r" + MH + " " + "scrolling=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " + "scrolling=no"

+ "\r" + MW + " " + MH + " " + "noresize=no>"

+ "\r" + f

+ "\r" + f

+ "\r" + nf

}

function frames3v(){

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=33%,33%,*" + " " + bc

+ "\r" + "<frame src=1.htm name=One" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " +

"scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function frames3h(){

document.Framer.Fillit.value=top

+ "\r" + "<frameset rows=33%,33%,*" + " " + bc

+ "\r" + "<frame src=1.htm name=One" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + "scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=3.htm" + " " + "name=Three" + " " +

"scrolling=auto"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + nf

}

function framemixb() {

document.Framer.Fillit.value=top

+ "\r" + "<frameset cols=30%,* " + bc + " " + "noresize=yes>"

+ "\r" + "<frameset rows=50%,*>" + "\r" +  "<frame src=1.htm" + " " +

"name=One"

+ " " + "scrolling=no" + " " + MW + "\r" + MH + " " + "noresize=yes>"

+ "\r" + "<frame src=2.htm" + " " + "name=Two" + " " + MW

+ "\r" + MH + " " + "scrolling=yes>"

+ "\r" + f

+ "\r" + "<frameset rows=50%,*>" + "\r" + "<frame src=3.htm" + " " +

"name=Three"

+ "\r" + "scrolling=no" +" " + MW + " " + MH + " " + "noresize=no>"

+ "\r" + "<frame src=4.htm" +" " + "name=Four" + " " + "scrolling=yes"

+ "\r" + MW + " " + MH + " " + "noresize=yes>"

+ "\r" + f

+ "\r" + f

+ "\r" + nf

}

function Copy(){

if (document.Framer.Fillit.value=="") {

alert ('The top box is empty. Please enter a script by clicking one of the frames buttons.')

}

else {

document.Framer.Pastebox.value=document.Framer.Fillit.value

}

}

function view(){

if (document.Framer.Pastebox.value=="") {

alert ('The paste box is empty. Please enter a script by clicking the Copy/Edit button.')

return false;

}

else {

alert('If you like the results, remember to paste it to a text editor!')

boat = open ("","DisplayWindow")

see = parent.document.Framer.Pastebox.value

boat.document.write (see)

return true;

}

}

function Instruct(){

 

help =

open("","helpWindow","resizable=yes,location=no,toolbar=no,directories=no,status=no,scrollbars=yes,menubar=no,width=500,height=250")

help.document.write("<TITLE>Frame Builder Help</TITLE>")

help.document.write("<P><Center><B><FONT SIZE=+0><FONT COLOR='black'>Instructions</FONT></FONT></B></Center></P>")

help.document.write("<P>1. Load a frame script into the top box by clicking one of the 6 pre built frame scripts buttons.")

help.document.write("<P>2. Copy the script to the bottom box using the <B>Copy/Edit</B> button. Edit the script from the bottom box. If a mistake is made, a fresh copy will allways be available in the top box to compare or to reload.</P>")

help.document.write("<P><B>Editing:</B></P>")

help.document.write("<LI>Make sure to change the frame src=???.htm to YOUR pages and rename name=?? to suit.</LI>")

help.document.write("<LI>Change the width or height of the frames by changing frameset Cols/Rows=?%.</LI>")

help.document.write("<LI>Deleting noresize=yes allows movable frames.</LI>")

help.document.write("<LI>Deleting bordercolor defaults to the Netscape grey bars.</LI>")

help.document.write("<LI>Changing bordercolor to border=no hides the bars.</LI>")

help.document.write("<LI>Changing scrolling=??? to auto or yes allows PAGE scrolling.</LI>")

help.document.write("<P>3. When satisfied with your changes in the bottom box, hit <b>View</b> to see the frames in a new window.</P>")

help.document.write("<P>4. Hit your browser'\s close option to return to the work window.</P>")

help.document.write("<P>5. When happy with how the frames look and operate, paste the script to a text editor. <B>Save it as an .htm file.</B></P>")

help.document.write("<P><CENTER><FORM><INPUT TYPE='button' VALUE='OK' onClick='window.close()'></CENTER></FORM></P>")

help.document.bgColor=('deepskyblue')

help.document.close()

}

</SCRIPT>

<DT><FORM Name="Framer"></DT>

<TABLE BORDER=1 >

<TR>

<TD>

<DT><INPUT Type=button Value="2 Vertical" onClick="framesa()"></DT>

<DT><INPUT Type=button Value="3 Vertical" onClick="frames3v()"></DT>

<DT><INPUT Type=button Value="2 Horizontal" onClick="framesb()"></DT>

<DT><INPUT Type=button Value="3 Horizontal" onClick="frames3h()"></DT>

<DT><INPUT Type=button Value="3 Mixed" onClick="framemixa()"></DT>

<DT><INPUT Type=button Value="4 Mixed" onClick="framemixb()"></DT>

</TD>

<TD VALIGN=TOP>

<DT><TEXTAREA Name=Fillit COLS="56" ROWS="6"></TEXTAREA></DT>

<CENTER><DT><INPUT Type=button Value="Instructions" onClick="Instruct()"></DT></CENTER>

</TD>

</TR>

<TR>

<TD>

<DT><INPUT Type=button Value="Copy/Edit" onClick="Copy()"></DT>

<DT><INPUT Type=button Value="Start Over" onClick="alert('Misfire? No problem, a new copy will be pasted to the bottom box. Good Luck!');Copy()"></DT>

<DT><INPUT Type=button Value="Clear All" onClick="reset()"></DT>

</TD>

<TD VALIGN=TOP>

<DT><TEXTAREA Name="Pastebox" COLS="56" ROWS="6"></TEXTAREA></DT>

<CENTER><DT><INPUT Type=button Value=" View It! "

onClick="view()"></DT></CENTER>

</TD>

</TR>

</TABLE>

</FORM><P>

</FONT></CENTER>

0 Comments

Thu

05

Mar

2009

141、主页制作器

141、主页制作器

脚本说明:

 

把如下代码加入区域中:

 

<FORM METHOD="Post" ACTION="">

 

<script language = "JavaScript">

 

 

 

 

 

<!--hide this script from old browsers

 

 

 

document.write('<B>Prompt mode is now working.</B><BR>')

 

 

 

 

 

 

 

document.write('<PRE><B>Help status:  </B>')

 

 

 

helpon = false  // ...true or false

 

 

 

document.write('<input type="radio" name="radiohelp"  value="true" onClick = " helpon = true"> ON ')

 

 

 

document.write('<input type="radio" name="radiohelp"  value="false" checked onClick = " helpon = false"> OFF <BR>')

 

 

 

 

 

 

 

document.write('<B>HTML mode:    </B>')

 

 

 

modeindex = 0   // ...0=simple, 1=sample, 2=prompt

 

 

 

document.write('<input type="radio" name="radiomode"  value="Copyright 1996  Ray Daly" checked onClick = " modeindex = 0 "> Simple ')

 

 

 

document.write('<input type="radio" name="radiomode"  value="Copyright 1996  Ray Daly" onClick = " modeindex = 1"> Sample ')

 

 

 

document.write('<input type="radio" name="radiomode"  value="Copyright 1996  Ray Daly" onClick = " modeindex = 2"> Prompt <BR></PRE>')

 

 

 

 

 

 

 

 

 

 

 

document.write('<TABLE CELLSPACING="0" BORDER="0">')

 

 

 

document.write('<TR><TH><input type="button" value=" Start " onClick="HjButton(this.form,jStart)">')

 

 

 

document.write('<input type="button" value=" End " onClick="HjButton(this.form,jEnd)">')

 

 

 

document.write('</TH><TH><input type="button" value="页面显示" onClick="preview(this.form)">')

 

 

 

document.write('</TH><TH><input type="button" value="保存" onClick="Save(this.form)">')

 

 

 

document.write('</TH><TH><input type="button" value="关于" onClick="About(this.form)">')

 

 

 

 

 

 

 

document.write('</TH></TR><TR><TH><input type="button" value=" B " onClick="HjButton(this.form,jBold)">')

 

 

 

document.write('<input type="button" value="  I  " onClick="HjButton(this.form,jItalics)">')

 

 

 

document.write('<input type="button" value=" PRE " onClick="HjButton(this.form,jPre)">  ')

 

 

 

 

 

 

 

document.write('</TH><TH><input type="button" value=" H1 " onClick="HjButton(this.form,jH1)">')

 

 

 

document.write('<input type="button" value=" H2 " onClick="HjButton(this.form,jH2)">')

 

 

 

document.write('<input type="button" value=" H3 " onClick="HjButton(this.form,jH3)">  ')

 

 

 

 

 

 

 

document.write('</TH><TH><input type="button" value=" OL " onClick="HjButton(this.form,jOL)">')

 

 

 

document.write('<input type="button" value=" UL " onClick="HjButton(this.form,jUL)">')

 

 

 

document.write('<input type="button" value=" LI " onClick="HjButton(this.form,jLI)">  ')

 

 

 

 

 

 

 

document.write('</TH><TH><input type="button" value=" DL " onClick="HjButton(this.form,jDL)">')

 

 

 

document.write('<input type="button" value=" DT " onClick="HjButton(this.form,jDT)">')

 

 

 

document.write('<input type="button" value=" DD " onClick="HjButton(this.form,jDD)"><BR>')

 

 

 

 

 

 

 

document.write('</TH></TR><TR><TH><input type="button" value=" P " onClick="HjButton(this.form,jPara)">')

 

 

 

document.write('<input type="button" value=" BR " onClick="HjButton(this.form,jBreak)">')

 

 

 

document.write('<input type="button" value=" HR " onClick="HjButton(this.form,jRule)">  ')

 

 

 

 

 

 

 

document.write('</TH><TH><input type="button" value="    Anchor     " onClick="HjButton(this.form,jAnchor)">  ')

 

 

 

 

 

 

 

document.write('</TH><TH><input type="button" value=" L" onClick="HjButton(this.form,jImageL)">')

 

 

 

document.write('<input type="button" value=" Image " onClick="HjButton(this.form,jImage)">')

 

 

 

document.write('<input type="button" value="R" onClick="HjButton(this.form,jImageR)">  ')

 

 

 

document.write('</TH><TH><input type="button" value="     Center     " onClick="HjButton(this.form,jCenter)">  ')

 

 

 

document.write('</TH></TR></TABLE>')

 

 

 

 

 

 

 

function HjReset (form) {                // ...required because RESET does not reset values, just GUI

 

 

 

               helpon = false

 

 

 

               modeindex = 0

 

 

 

               form.TEXT.value = ""

 

 

 

}

 

 

 

 

 

 

 

function HTMLtag (buttonname, insertmode, inserttext, tagstart, tagmiddle, tagend, sampletext, sampletext2, helptext) {

 

 

 

        // ...this fuction defines the object HTMLtag

 

 

 

        this.buttonname = buttonname

 

 

 

        this.insertmode = insertmode   

 

 

 

                // ...1=none 2=standard input 3=lists (UL and OL) 4=DL list 5=anchor

 

 

 

        this.inserttext = inserttext    // ...prompt when asking for insert text

 

 

 

        this.tagstart   = tagstart

 

 

 

        this.tagmiddle  = tagmiddle

 

 

 

        this.tagend     = tagend

 

 

 

        this.sampletext = sampletext    // ...sample text placed between tags in TextArea

 

 

 

        this.sampletext2= sampletext2

 

 

 

        this.helptext   = helptext

 

 

 

}

 

 

 

 

 

 

 

jStart = new HTMLtag ( "Start", "2", "Enter the document TITLE", " <HTML><HEAD><TITLE>", "",               "</TITLE></HEAD><BODY>",

 

 

 

        "Title of the document (eg. HTMLjive Page)", "" ,

 

 

 

        "Tags for start of document and the TITLE go here.  Use the END button when your document is complete." )

 

 

 

jEnd = new HTMLtag ( "End", "1", "", " </BODY></HTML>", "", "",

 

 

 

        "", "" ,

 

 

 

        "This puts in the closing tags when your document is complete." )

 

 

 

 

 

 

 

jBold = new HTMLtag ( "B", "2", "Enter the text to be BOLD", " <B>", "", "</B>",

 

 

 

        "This will be bold", "" ,

 

 

 

        "The text placed between the <B> and the </B> will be BOLD" )

 

 

 

jItalics = new HTMLtag ( "I", "2", "Enter the text to be ITALICIZED", " <I>", "", "</I>",

 

 

 

        "This will be in italics", "" ,

 

 

 

        "The text placed between the <I> and the </I> will be ITALICIZED" )

 

 

 

jPre = new HTMLtag ( "PRE", "2", "Enter the text to be PREformatted", " <PRE>", "", "</PRE>",

 

 

 

        "This will be PREformatted", "" ,

 

 

 

        "The text placed between the <PRE> and the </PRE> will be PREformatted" )

 

 

 

jPara = new HTMLtag ( "P", "2", "Enter the text for a PARAGRAPH", " <P>", "", "</P>",

 

 

 

        "Start of a PARAGRAPH that continues until the start of next PARAGRAPH.", "" ,

 

 

 

        "The text placed after the <P> will be a separate PARAGRAPH until the next <P>" )

 

 

 

jBreak = new HTMLtag ( "BR", "1", "", " <BR>", "", "",

 

 

 

        "", "" ,

 

 

 

        "This tag forces a line break, start of the next line." )

 

 

 

jRule = new HTMLtag ( "HR", "1", "", " <HR>", "", "",

 

 

 

        "", "" ,

 

 

 

        "This tag puts a (horizontal rule) line on the page." )

 

 

 

jH1 = new HTMLtag ( "H1", "2", "Enter the text for the HEADLINE", " <H1>", "", "</H1>",

 

 

 

        "This will be a top level HEADLINE", "" ,

 

 

 

        "The text placed between the <H1> and the </H1> will be the HEADLINE." )

 

 

 

jH2 = new HTMLtag ( "H2", "2", "Enter the text for the HEADLINE", " <H2>", "", "</H2>",

 

 

 

        "This will be a next to top level HEADLINE", "" ,

 

 

 

        "The text placed between the <H2> and the </H2> will be the HEADLINE." )

 

 

 

jH3 = new HTMLtag ( "H3", "2", "Enter the text for the HEADLINE", " <H3>", "", "</H3>",

 

 

 

        "This will be a third from top level HEADLINE", "" ,

 

 

 

        "The text placed between the <H3> and the </H3> will be the HEADLINE." )

 

 

 

jCenter = new HTMLtag ( "Center", "2", "Enter the text to be CENTERED", " <CENTER>", "", "</CENTER>",

 

 

 

        "This will be a CENTERED", "" ,

 

 

 

        "The text placed between the <CENTER> and the </CENTER> will be the CENTERED." )

 

 

 

jOL = new HTMLtag ( "OL", "3", "Enter FIRST item for (Numbered) ORDERED LIST", " <OL><LI> ", "</LI><LI> ", "</LI></OL>",

 

 

 

        "This is one item in the numbered list", "Next item in the numbered list" ,

 

 

 

        "Create an ORDERED LIST by placing multiple items between <LI> and </LI>" )

 

 

 

jOL.inserttext2 = "Enter NEXT item for ORDERED LIST"

 

 

 

 

 

 

 

jUL = new HTMLtag ( "UL", "3", "Enter FIRST item for (Plain) UNORDERED LIST", " <UL><LI> ", "</LI><LI> ", "</LI></UL>",

 

 

 

        "This is one item in the plain list", "Next item in the plain list" ,

 

 

 

        "Create an ORDERED LIST by placing multiple items between <LI> and </LI>" )

 

 

 

jUL.inserttext2 = "Enter NEXT item for UNORDERED LIST"

 

 

 

 

 

 

 

jLI = new HTMLtag ( "LI", "2", "Enter the text for an item in a LIST", " <LI>", "", "</LI>",

 

 

 

        "This is an item in a LIST", "" ,

 

 

 

        "The text placed between the <L1> and the </L1> will one item in a LIST.  Requires OL or UL." )

 

 

 

jDL = new HTMLtag ( "UL", "4", "Enter item for DEFINITION LIST", " <DL><DT>", "</DT> <DD>", " </DD></DL>",

 

 

 

        "Item to be defined", "Definition of the item" ,

 

 

 

        "DEFINITION LISTS have two elements: item and definition.  Enter the item." )

 

 

 

jDL.inserttext2 = "Enter the definition "

 

 

 

jDL.tagmiddle2='</DD> <DT>'

 

 

 

 

 

 

 

jDT = new HTMLtag ( "DT", "2", "Enter item for a DEFINITION LIST", " <DT>", "", "</DT>",

 

 

 

        "This is item for a DEFINITION LIST", "" ,

 

 

 

        "The text placed between the <DT> and the </DT> will one item in a LIST.  Requires DL." )

 

 

 

jDD = new HTMLtag ( "DD", "2", "Enter definition for a DEFINITION LIST", " <DD>", "", "</DD>",

 

 

 

        "This is definition in a DEFINITION LIST", "" ,

 

 

 

        "The text placed between the <DD> and the </DD> will one item in a LIST.  Requires DL." )

 

 

 

jImageL = new HTMLtag ("Image", 2, "Enter the URL (e.g., sample.gif)", ' <IMG SRC="', "", '" ALIGN=LEFT>',

 

 

 

        "URL to graphic (e.g. sample.gif)" , "",

 

 

 

        "Enter the URL for the graphic (e.g., sample.gif) for LEFT alignment" )

 

 

 

jImage = new HTMLtag ("Image", 2, "Enter the URL (e.g., sample.gif)", ' <IMG SRC="', "", '">',

 

 

 

        "URL to graphic (e.g. sample.gif)" , "",

 

 

 

        "Enter the URL for the graphic (e.g., sample.gif)" )

 

 

 

jImageR = new HTMLtag ("Image", 2, "Enter the URL (e.g., sample.gif)", ' <IMG SRC="', "", '" ALIGN=RIGHT>',

 

 

 

        "URL to graphic (e.g. sample.gif)" , "",

 

 

 

        "Enter the URL for the graphic (e.g., sample.gif) for RIGHT alignment" )

 

 

 

jAnchor = new HTMLtag ("Anchor", 5, "Enter the URL (e.g., http://www.yahoo.com)", ' <A HREF="', '"> ', '</A>',

 

 

 

        "http://www.yahoo.com", "Yahoo (description here)",

 

 

 

        "Enter the URL (e.g., http://www.yahoo.com/index.html) followed by the description." )

 

 

 

jAnchor.inserttext2 = "Enter description (e.g., Yahoo)"

 

 

 

 

 

 

 

function About (form) {

 

 

 

        alert('网络时空panda  http://www.k688.com')

 

 

 

}

 

 

 

function Save (form) {

 

 

 

        alert('No SAVE function is available.  You must "cut & paste" your document into another application.')

 

 

 

}

 

 

 

function HjButton (form,selection) {    // ...all HTML button call this routine

 

 

 

        if (helpon) {

 

 

 

                if (confirm(selection.helptext)){

 

 

 

                        addHTML (form,selection)

 

 

 

                }

 

 

 

        }else{

 

 

 

                addHTML (form,selection)

 

 

 

        }

 

 

 

}

 

 

 

 

 

 

 

function addHTML (form,selection) {

 

 

 

        // ...add text to value ot TextArea

 

 

 

        cancel = false

 

 

 

        addText=selection.tagstart

 

 

 

        if (modeindex==2) {     // ...insert mode

 

 

 

                if (selection.insertmode != 1 ) {       // ...if none, skip it all

 

 

 

                        addText += addHTMLinsert (selection, addText, form)

 

 

 

                        if (addText == selection.tagstart) {

 

 

 

                                cancel = true

 

 

 

                        }

 

 

 

                }

 

 

 

        }

 

 

 

        if (modeindex==1) {     // ...sample mode

 

 

 

                addText = addText + selection.sampletext + selection.tagmiddle + selection.sampletext2

 

 

 

        }

 

 

 

        if (modeindex==0) {     // ...simple mode

 

 

 

                addText += selection.tagmiddle

 

 

 

        }

 

 

 

        addText += selection.tagend

 

 

 

        if (cancel == false) {  // ...put text into TextArea unless canceled

 

 

 

                form.TEXT.value += addText

 

 

 

        }

 

 

 

}

 

 

 

       

 

 

 

function addHTMLinsert (selection, addText, form) {

 

 

 

        // ...insert mode

 

 

 

        // ...addText alread as .tagstart, cancel=false

 

 

 

        // ...insertmodes 1=none, 2=insert, 3=lists (UL and OL), 4=DL list, 5=anchor

 

 

 

        if (selection.insertmode ==2) {         // ...simple insert (eg.<B>...</B>

 

 

 

                i = ""

 

 

 

                i = prompt (selection.inserttext, "")

 

 

 

                if ((i != null) && (i != "")) {                 // ...if input add

 

 

 

                        addText = i

 

 

 

                }else{

 

 

 

                        addText = ""

 

 

 

                }

 

 

 

        }

 

 

 

        if (selection.insertmode == 3) {        // ...UL and OL lists

 

 

 

                addText = ""

 

 

 

                i = ""

 

 

 

                i = prompt (selection.inserttext, "")

 

 

 

                if ((i != null) && (i != "")) {

 

 

 

                        addText = i

 

 

 

                        while ((i != null) && (i != "")) {      // ...get next until null

 

 

 

                                i=prompt (selection.inserttext2, "")

 

 

 

                                if ((i != null) && (i != "")) {

 

 

 

                                        addText=addText + selection.tagmiddle + i

 

 

 

                                }

 

 

 

                        }

 

 

 

                }

 

 

 

        }

 

 

 

        if (selection.insertmode == 4) {        // ...DL list

 

 

 

                i= "dummy"

 

 

 

                j = i

 

 

 

                addText = ""

 

 

 

                count = 0

 

 

 

                while ((i != null) && (i != "") && (j != null) && (j !="")) {   // ...get next until null

 

 

 

                        ++count

 

 

 

                        i = ""

 

 

 

                        i = prompt (selection.inserttext, "")

 

 

 

                        // ... used for debugging form.TEXT.value += "-->" + i + "<--"

 

 

 

                        if ((i != null) && (i != "")) {

 

 

 

                                j = ""

 

 

 

                                j=prompt (selection.inserttext2, "")

 

 

 

                                if ((j != null) && (j != "")) {

 

 

 

                                        if (count > 1){

 

 

 

                                                addText += selection.tagmiddle2

 

 

 

                                        }

 

 

 

                                        addText=addText +i + selection.tagmiddle + j

 

 

 

                                }

 

 

 

                        }

 

 

 

                }

 

 

 

        }

 

 

 

        if (selection.insertmode == 5) {        // ...Anchor

 

 

 

                addText = ""

 

 

 

                i = ""

 

 

 

                i = prompt (selection.inserttext, "")

 

 

 

                // ... used for debugging form.TEXT.value += "-->" + i + "<--"

 

 

 

                if ((i != null) && (i != "")) {

 

 

 

                        j = ""

 

 

 

                        j=prompt (selection.inserttext2, "")

 

 

 

                        if ((j != null) && (j != "")) {

 

 

 

                                addText=i + selection.tagmiddle + j

 

 

 

                        }

 

 

 

                }

 

 

 

        }

 

 

 

        return addText

 

 

 

}

 

 

 

function preview(form) {

 

 

 

             msg=open("","DisplayWindow","toolbar=no,directories=no,menubar=yes");

 

 

 

             msg.document.write(form.TEXT.value);

 

 

 

}

 

 

 

<!-- done hiding from old browsers -->

 

 

 

 

 

</script>

 

 

 

 

 

 

 

<b>HTMLjive Document:</b><br>

 

 

 

<TEXTAREA NAME="TEXT" ROWS="16" COLS="75" WRAP="VIRTUAL"></TEXTAREA>

 

 

 

<INPUT TYPE="reset" VALUE= "Erase and Restart Document" onClick="HjReset(this.form)">

 

 

 

</FORM>

 

 

0 Comments

Thu

05

Mar

2009

140、动态按钮代码生成器

140、动态按钮代码生成器

脚本说明:

第一步:把如下代码加入<head>区域中:

<script language="javascript">

<!--Hide

//timer

speed = 10;

//Array to make Objects

Imagi        = new Array();

//numbers of Link

no_of_images = 0;

currentImage = -1;

 

function checkBrowser() {

       var bname = navigator.appName;

       var ver   = parseInt(navigator.appVersion);

       if (bname == "Netscape" && ver >= 3 || bname == "Microsoft Internet Explorer" && ver >= 4)

       ;

       else {

              alert('You need Netscape Navigator 3 and above or Microsoft Internet Explorer 4 and above')

             

       }

}

 

checkBrowser();

 

//The Image Object

function ImageObject(Name, OffSrcPro, OffSrc, OnSrcPro, OnSrc, Width, Height, Alt, Border, URL, LinkTarget) {

        this.Name                  = Name;

        this.OffSrcPro       = OffSrcPro;

        this.OffSrc           = OffSrc;

        this.OnSrcPro          = OnSrcPro;

        this.OnSrc            = OnSrc;

        this.Width               = Width;

        this.Height          = Height;

        this.Alt             = Alt;

        this.Border        = Border;

        this.URL                  = URL;

        this.LinkTarget      = LinkTarget;

        this.length         = 11;

}

 

function headerSelect(grut, grutv) {

  if (grut.options[0].selected) {

        grutv.value = "";

  }

  else {

     for (var y=0; y < grut.length; y++) {

          if (grut.options[y].selected) {

               grutv.value = "";

               grutv.value += grut.options[y].text;

        }

    }

  }

}

 

//Function Performing Form Validation

function checkMe(Me) {

        with(Me) {

                SrcBox1.focus();

                SrcBox1.blur();

                SrcBox2.focus();

                SrcBox2.blur();

                if (URLBox.value == "http://" || URLBox.value == "") {

                    alert("连接的URL没有设置");

                     URLBox.focus();

                     return false;

                }

                if (SrcBox1.value == "") {

                    alert("MouseOut图片尚未设置");

                     SrcBox1.focus();

                     return false;

                }

                if (SrcBox2.value == "") {

                       alert("MouseOver图片尚未设置");

                       SrcBox2.focus();

                       return false;

                } 

                if (NameBox.value == "") {

                       alert("图片尚未命名");

                       NameBox.focus();

                       return false;

                } 

                return true;

        }

}

 

 

 function checkAndShow() {

         with(window.document.mouseOverForm.Images) {

               if (options.length != 0) {

                  for(var i=0; i < options.length; i++) {

                          if (options[i].selected) {

                                  with(window.document.mouseOverForm) {

                                          URLBox.value = Imagi[i].URL;

                                          TargetBox.value = Imagi[i].LinkTarget;

                                           HeadSrc1.value = Imagi[i].OffSrcPro;

                                          HeadSrc2.value = Imagi[i].OnSrcPro;

                                          SrcBox1.value  = Imagi[i].OffSrc;

                                        SrcBox2.value  = Imagi[i].OnSrc;

                                           NameBox.value  = Imagi[i].Name;

                                           BorderBox.value = Imagi[i].Border

                                           AltBox.value   = Imagi[i].Alt;

                                           WidthBox.value = Imagi[i].Width;

                                           HeightBox.value = Imagi[i].Height;

                                     currentImage = i;

                                           if (HeadSrc1.value == "file:///")

                                                  Header1.options[1].selected = true;

                                          else if (HeadSrc1.value == "http://")

                                               Header1.options[2].selected = true;

                                     else if (HeadSrc1.value == "")

                                            Header1.options[0].selected = true;

                                          if (HeadSrc2.value == "file:///")

                                                  Header2.options[1].selected = true;

                                          else if (HeadSrc2.value == "http://")

                                               Header2.options[2].selected = true;

                                        else if (HeadSrc2.value == "")

                                               Header2.options[0].selected = true;

                                    }

                          }

                  }

        }

       }    

 }

 

 

function insertItem() {

       with(window.document.mouseOverForm) {

              if (checkMe(window.document.mouseOverForm)) {

                     Imagi[no_of_images] = new ImageObject(NameBox.value, HeadSrc1.value, SrcBox1.value, HeadSrc2.value, SrcBox2.value, WidthBox.value, HeightBox.value, AltBox.value, BorderBox.value, URLBox.value, TargetBox.value);

                     Images.length += 1;

                     Images.options[Images.length - 1].text = Imagi[no_of_images].Name;

                     ++no_of_images;

                     CleanBoxes(window.document.mouseOverForm);

                     CleanBoxes(window.document.mouseOverForm);

              }

       }

}

 

//Clean options[0] when page loaded

function Clean() {

       abc = document.forms[0].Images;

       if (Imagi.length == 0 && abc.length != 0) {

              for(var loop = 0; loop < abc.length; loop++)

                     abc.options[loop] = null;

       }

}

 

function UpdateOption() {

       with(window.document.mouseOverForm) {

              if (currentImage != -1) {

                     if (confirm("确信要更新这些数据?")) {

                         Imagi[currentImage].URL         = URLBox.value;

                         Imagi[currentImage].LinkTarget  = TargetBox.value;

                         Imagi[currentImage].Name          = NameBox.value;

                         Imagi[currentImage].OffSrcPro    = HeadSrc1.value;

                         Imagi[currentImage].OnSrcPro     = HeadSrc2.value;

                         Imagi[currentImage].OffSrc  = SrcBox1.value;

                         Imagi[currentImage].OnSrc          = SrcBox2.value;

                         Imagi[currentImage].Width       = WidthBox.value;

                         Imagi[currentImage].Height      = HeightBox.value;

                         Imagi[currentImage].Alt         = AltBox.value;

                         Imagi[currentImage].Border      = BorderBox.value;

                         Images.options[currentImage].text = Imagi[currentImage].Name;

                         alert("数据已经更新!");

                         CleanBoxes(window.document.mouseOverForm);

                         CleanBoxes(window.document.mouseOverForm);

                   }

           }

           else

                     alert("你尚未选择任何项目!");

      }

}

 

function removeIt() {

       if (document.mouseOverForm.Images.selectedIndex < 0)

              alert("你尚未选择任何项目!");

 

       with(document.mouseOverForm.Images) {

              for (var t=0; t < length; t++) {

                  if (options[t].selected) {

                         if (confirm("确信移去图片?")) {

                                for(var z = t; z < length-1; z++) {

                                       Imagi[z].URL = Imagi[z+1].URL;

                                          Imagi[z].LinkTarget = Imagi[z+1].LinkTarget;

                                          Imagi[z].OffSrcPro = Imagi[z+1].OffSrcPro;

                                          Imagi[z].OnSrcPro = Imagi[z+1].OnSrcPro;

                                          Imagi[z].OffSrc = Imagi[z+1].OffSrc;

                                          Imagi[z].OnSrc = Imagi[z+1].OnSrc;

                                          Imagi[z].Name = Imagi[z+1].Name;

                                          Imagi[z].Border = Imagi[z+1].Border;

                                          Imagi[z].Alt = Imagi[z+1].Alt;

                                          Imagi[z].Height = Imagi[z+1].Height;

                                          Imagi[z].Width = Imagi[z+1].Width;

                                }    

                                Imagi.length -= 1;

                                --no_of_images;

                                options[t] = null;

                                CleanBoxes(window.document.mouseOverForm);

                        }

                     }

              }

       }

} 

 

function Debug() {

       var no = prompt("Please enter the Object number you want to debug", "");

       var second_argu = "Imagi[" + no + "]";

       show_props(Imagi[no], second_argu);

}

 

//for debugging usage

function show_props(obj, obj_name) {

       var result = "";

       for (var i in obj)

              result += obj_name + "." + i + " = " + obj[i] + "\n";

       alert(result);

}

 

//Clean the options[0] when page loaded

function Clean() {

       abc = document.mouseOverForm.Images;

       if (Imagi.length == 0 && abc.length != 0) {

              for(var loop = 0; loop < abc.length; loop++)

              abc.options[loop] = null;

       }

}

 

//Clean the value in the fields

function CleanBoxes(argv) {

       var x = 0; //counter

       while(x != argv.length - 1) {

              if (argv.elements[x].type == "text") {

                     argv.elements[x].value = "";

              }

       x++;

       argv.URLBox.value = "http://";

       argv.Header1.options[0].selected = true;

       argv.Header2.options[0].selected = true;

       argv.HeadSrc1.focus();

       argv.HeadSrc1.blur();

       argv.HeadSrc1.value = "";

       argv.HeadSrc2.focus();

       argv.HeadSrc2.blur();

       argv.HeadSrc2.value = "";  

       argv.SrcBox1.focus();

       argv.SrcBox1.blur();

       argv.SrcBox1.value = "";

       argv.SrcBox2.focus();

       argv.SrcBox2.blur();

       argv.SrcBox2.value = "";  

       argv.URLBox.focus();

       }

}

 

closedd = true;

function PopDrive(no) {

       if (closedd) {

       Box = no;

       First = '<html><body bgcolor="white" text="#000000" link="#000099" vlink="#663366" alink="#ff0000" onUnLoad="window.opener.closedd = true;"   ><center><br><form><input type="file" name="Drive"><br><br><input type="Button" value="OK" name="OK" onClick="window.opener.Make(document.forms[0], ' + Box + '); ' + 'window.opener.CheckAndChange(' + Box + '); ' + '"><input type="Button" name="Cancel" value="Cancel" onClick="window.close();window.opener.closedd = true;"></form></center><blockquote><font face="宋体" size=2>通过"浏览"按钮从硬盘上选择图片文件,然后按"OK"继续。</font></blockquote></body></html>';

       Pop = window.open("", "DriveWin", "Width=350,Height=200,resizable=yes");

       Pop.document.open();

       Pop.document.write(First);

       closedd = false;

       }

      else

       Pop.focus();

}

 

function Make(na, no) {

       na.Drive.focus();

       na.Drive.blur();

       if (na.Drive.value == "") {

              alert("文件尚未选择!");

              Pop.focus();

       }

       else {

              if (no == 1) {

                     document.mouseOverForm.SrcBox1.value = na.Drive.value;

                     document.mouseOverForm.Header1.options[1].selected = true;

                     document.mouseOverForm.HeadSrc1.value = "file:///";

              }

              else if (no == 2) {

                     document.mouseOverForm.SrcBox2.value = na.Drive.value;

                     document.mouseOverForm.Header1.options[1].selected = true;

                     document.mouseOverForm.HeadSrc2.value = "file:///";

              }

              Pop.close();

              window.closedd = true;

       }

}

 

//Check the image source, then change the protocol if needed

function CheckAndChange(no) {

       if (no == 1) {

              SrcBox = document.mouseOverForm.SrcBox1;

              Selection = document.mouseOverForm.Header1;

              ProtocolBox = document.mouseOverForm.HeadSrc1;

       }

       else if (no == 2) {

              SrcBox = document.mouseOverForm.SrcBox2;

              Selection = document.mouseOverForm.Header2;

              ProtocolBox = document.mouseOverForm.HeadSrc2;

       }

 

       var c = SrcBox.value.indexOf("http://");

       var d = SrcBox.value.indexOf("file:///");

       if (c >= 0) {

       Selection.options[2].selected = true;

       ProtocolBox.value = "http://";

       Stringo2 = SrcBox.value.substring(c+7);

       SrcBox.value = Stringo2;

       }

       else if (d >= 0) {

       Selection.options[1].selected = true;

       ProtocolBox.value = "file:///";

       Stringo3 = SrcBox.value.substring(d+8);

       SrcBox.value = Stringo3;

       }

 

       var find2 = SrcBox.value.indexOf("/")

 

       if (SrcBox.value.indexOf(":\\") > 0 || SrcBox.value.indexOf("|/") > 0) {

              Selection.options[1].selected = true;

              ProtocolBox.value = "file:///";

              var cr = SrcBox.value.indexOf(":\\");

              if (cr >= 0) {

                     SrcBox.value = stringInsert(SrcBox.value, "|", cr);

                     for(var countIt = cr; countIt < SrcBox.value.length; countIt++) {

                     var Athere = SrcBox.value.charAt(countIt);

                            if (Athere == "\\")

                            SrcBox.value = stringInsert(SrcBox.value, "/", countIt);   

                     }

              }

       }

      else if ((SrcBox.value.indexOf(".com") > 0) || (SrcBox.value.indexOf(".edu") > 0) || (SrcBox.value.indexOf(".org") > 0) || (SrcBox.value.indexOf(".net") > 0) || (SrcBox.value.indexOf(".gov") > 0) || (SrcBox.value.indexOf(".mil") > 0) || (SrcBox.value.indexOf(".arpa") > 0) || (SrcBox.value.indexOf(".int") > 0)) {

       Selection.options[2].selected = true;

       ProtocolBox.value = "http://";

      }

       else if (find2 > 0) {

              var yes = 0;

              var c = 0;

              var Stringoo2 = SrcBox.value.substring(0, find2);

              for(var a = 0; a < 3; a++) {

                     var b = Stringoo2.indexOf(".", c);

                     if (b > 0) {

                            c = b + 1;

                            yes++;

                     }

             }

              if (yes == 3) {

                    Selection.options[2].selected = true;

                     ProtocolBox.value = "http://";

              }

       } 

       else {

              Selection.options[0].selected = true;

              ProtocolBox.value = "";

       }

 

       if (SrcBox.value != "") {

              var Stringo = SrcBox.value.toUpperCase();

              if (Stringo.indexOf(".GIF") < 0 && Stringo.indexOf(".JPG") < 0 && Stringo.indexOf(".JPEG") < 0 && Stringo.indexOf(".PNG") < 0) {

                     alert("看样子没有设置正确的图片文件:)");

                     SrcBox.focus();

             }

       }

}

 

 

function stringInsert(initial, replace, position) {

 

       start=parseInt(position);

 

       end=start+replace.length;

 

       newVal=initial.substring(0,start)+replace+initial.substring(end,initial.length);

 

       return newVal;

 

}

  

function isDigit(form) {

       for (var x = 0; x < form.value.length; x++) {

              var y = form.value.charAt(x);

              var g = parseInt(y);

              if (g >= 0 && g <= 9)

                     ;

              else {

                     alert("非法的参数");

                     form.focus();

                     return false;

              }

       }

       return true;

}

   

function InsertBelow()

{

 with(window.document.mouseOverForm)

 {

  if(Images.selectedIndex != -1)

  {

   for(var g=0; g < Imagi.length - 1; g++)

   {

    if (Images.options[g].selected)

    {

     var r = no_of_images;

     Imagi[r] = new ImageObject( Imagi[r-1].Name, Imagi[r-1].OffSrcPro, Imagi[r-1].OffSrc, Imagi[r-1].OnSrcPro, Imagi[r-1].OnSrc, Imagi[r-1].Width, Imagi[r-1].Height, Imagi[r-1].Alt, Imagi[r-1].Border, Imagi[r-1].URL, Imagi[r-1].LinkTarget );

     for(var p = Imagi.length-2; p > g; p--)

     {

      Imagi[p].Name          = Imagi[p-1].Name;

      Imagi[p].OffSrcPro     = Imagi[p-1].OffSrcPro;

      Imagi[p].OffSrc        = Imagi[p-1].OffSrc;

      Imagi[p].OnSrcPro      = Imagi[p-1].OnSrcPro;

      Imagi[p].OnSrc         = Imagi[p-1].OnSrc;

      Imagi[p].Width         = Imagi[p-1].Width;

      Imagi[p].Height        = Imagi[p-1].Height;

      Imagi[p].Alt           = Imagi[p-1].Alt;

      Imagi[p].Border        = Imagi[p-1].Border;

      Imagi[p].URL           = Imagi[p-1].URL;

      Imagi[p].LinkTarget           = Imagi[p-1].LinkTarget;

     }  

 

     Imagi[g+1].URL       = URLBox.value;

     Imagi[g+1].LinkTarget  = TargetBox.value;

     Imagi[g+1].Name              = NameBox.value;

     Imagi[g+1].OffSrcPro = HeadSrc1.value;

     Imagi[g+1].OnSrcPro  = HeadSrc2.value;

     Imagi[g+1].OffSrc      = SrcBox1.value;

     Imagi[g+1].OnSrc              = SrcBox2.value;

     Imagi[g+1].Width       = WidthBox.value;

     Imagi[g+1].Height      = HeightBox.value;

     Imagi[g+1].Alt         = AltBox.value;

     Imagi[g+1].Border      = BorderBox.value;

     no_of_images++;

     Images.length += 1;

 

     for(var b = Images.options.length - 1; b > g; b--)

     {

      Images.options[b].text =  Images.options[b-1].text;

     }

      Images.options[g+1].text = Imagi[g+1].Name;

      CleanBoxes(window.document.mouseOverForm);

    }

   }

  }

  else

    {

     if(Images.length != 0)

     {

      var g = -1;

      var r = no_of_images;

     Imagi[r] = new ImageObject( Imagi[r-1].Name, Imagi[r-1].OffSrcPro, Imagi[r-1].OffSrc, Imagi[r-1].OnSrcPro, Imagi[r-1].OnSrc, Imagi[r-1].Width, Imagi[r-1].Height, Imagi[r-1].Alt, Imagi[r-1].Border, Imagi[r-1].URL, Imagi[r-1].LinkTarget );

 

     for(var p = Imagi.length-2; p > g; p--)

     {

      Imagi[p].Name          = Imagi[p-1].Name;

      Imagi[p].OffSrcPro     = Imagi[p-1].OffSrcPro;

      Imagi[p].OffSrc        = Imagi[p-1].OffSrc;

      Imagi[p].OnSrcPro      = Imagi[p-1].OnSrcPro;

      Imagi[p].OnSrc         = Imagi[p-1].OnSrc;

      Imagi[p].Width         = Imagi[p-1].Width;

      Imagi[p].Height        = Imagi[p-1].Height;

      Imagi[p].Alt           = Imagi[p-1].Alt;

      Imagi[p].Border        = Imagi[p-1].Border;

      Imagi[p].URL           = Imagi[p-1].URL;

      Imagi[p].LinkTarget           = Imagi[p-1].LinkTarget;

     }  

    

     Imagi[g+1].URL       = URLBox.value;

     Imagi[g+1].LinkTarget  = TargetBox.value;

     Imagi[g+1].Name              = NameBox.value;

     Imagi[g+1].OffSrcPro = HeadSrc1.value;

     Imagi[g+1].OnSrcPro  = HeadSrc2.value;

     Imagi[g+1].OffSrc      = SrcBox1.value;

     Imagi[g+1].OnSrc              = SrcBox2.value;

     Imagi[g+1].Width       = WidthBox.value;

     Imagi[g+1].Height      = HeightBox.value;

     Imagi[g+1].Alt         = AltBox.value;

     Imagi[g+1].Border      = BorderBox.value;

     no_of_images++;

     Images.length += 1;

 

     for(var b = Images.options.length - 1; b > g; b--)

     {

      Images.options[b].text =  Images.options[b-1].text;

     }

      Images.options[g+1].text = Imagi[g+1].Name;

      CleanBoxes(window.document.mouseOverForm);

     }

     else

     alert("缺少项目!")

    }

 }

}

 

function CheckIt(array, string) {

       if (array == null || array == "")

              variable = "";

       else

              variable = string + array + "\"";

       return variable;

}

 

function generateIt() {

       if (document.mouseOverForm.Images.length != 0) {

              HeadCode = "<SCRIPT LANGUAGE=\"Javascript\">\r" + "<" + "!-" + "-Hide\r\r";

              HeadCode += "//http://www.k688.com/javascript/dai5.htm\r\r";

              HeadCode += "function isCompatible()\r" + "{\r" + " var BrowserName = navigator.appName;\r" + " var BrowserVer  = parseInt(navigator.appVersion);\r" + " var Compatible  = (BrowserName == \"Netscape\" && BrowserVer == 3) || (BrowserName == \"Netscape\" || BrowserVer == 4) || (BrowserName == \"Microsoft Internet Explorer\" || BrowserVer == 4)\r" + " return Compatible;\r" + "}\r\r";

              HeadCode += "function flipIt(img, tothis)\r" + "{\r" + " if (isCompatible())\r" + " {\r" + "  img.src = tothis.src;\r" + " }\r" + "}\r\r";

 

              BodyCode = "";

              for (var count = 0; count < Imagi.length; count++) {

                     var xName = Imagi[count].Name;

                     var xNameOff = Imagi[count].OffSrcPro + Imagi[count].OffSrc;

                     var xNameOn  = Imagi[count].OnSrcPro + Imagi[count].OnSrc;

                     var Target = CheckIt(Imagi[count].LinkTarget, " TARGET=\"");

                     var Border = CheckIt(Imagi[count].Border, " BORDER=\"");

                     var Alt = CheckIt(Imagi[count].Alt, " ALT=\"");

                     var Width = CheckIt(Imagi[count].Width, " WIDTH=\"");

                     var Height = CheckIt(Imagi[count].Height, " HEIGHT=\"");

                     var MouseOver = "onMouseOver=\"flipIt(document." + xName + ", " + xName + "On);\"";

                     var MouseOut = "onMouseOut=\"flipIt(document." + xName + ", " + xName + "Off);\"";

 

                     HeadCode += xName + "Off = new Image();\r";

                     HeadCode += xName + "Off.src = " + "\"" + xNameOff + "\";" + "\r";

                     HeadCode += xName + "On = new Image();\r";

                     HeadCode += xName + "On.src  = " + "\"" + xNameOn + "\";" + "\r";

                     BodyCode += "<A HREF=\""+ Imagi[count].URL + "\""  + Target + " " + MouseOver + " " + MouseOut + "><IMG SRC=\"" + xNameOff + "\" NAME=\"" + xName + "\"" + Border + Alt + Width + Height + "></A>\r\r";

              }

              HeadCode += "\r/" + "/End Hide-" + "->\r</SCRIPT>";

              Emulate = window.open("", "CodeWindow", "width=640,height=420,status=yes,resizable=yes,scrollbars=yes");

              Emulate.document.clear();

              Emulate.document.write('<html><head><title>Code generated</title></head><body bgcolor="#ffffff" text="#000000" link="#000099" vlink="#663366" alink="#ff0000">');

              Emulate.document.write("<br><br><center><font face=\"宋体\">如下代码拷贝到<font color=\"red\">HEAD</font>标签间</font></center><form name=\"genCode\"><center><textarea cols=55 rows=16 name=\"Head\" wrap=\"Virtual\">

 

0 Comments

Thu

05

Mar

2009

颜色代码生成器

139、颜色代码生成器

脚本说明:

第一步:把如下代码加入<head>区域中:

<script language=JavaScript1.2>

<!--

var bName=navigator.appName;

var bVer=parseInt(navigator.appVersion);

var NS4=(bName=="Netscape" && bVer >= 4);

var IE4=(bName=="Microsoft Internet Explorer" && bVer >= 4);

var fstr_r;

var fstr_g;

var fstr_b;

var sItem="S";

 

function display(id, str){

  if(NS4 || IE4){

    if(NS4){

      with (document[id].document){

        open(); write(str); close();

      }

    }else document.all[id].innerHTML=str;

  }else{

    document.fsample2.startcolor.value=document.GradForm.start.value;

    document.fsample2.endcolor.value=document.GradForm.end.value;

  }

}

 

function makeArray(){

  for(i = 0; i<makeArray.arguments.length; i++)

    this[i] = makeArray.arguments[i];

}

 

var convert = new makeArray('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');

 

function returnBase(number,base) {

  eval("var output=parseInt(number)");

  if(isNum(number,base)){

    if(number < base) output = convert[output];

    else{

      var MSD = '' + Math.floor(number / base);

      var LSD = number - MSD*base;

      if(MSD > base) output = returnBase(MSD,base) + convert[LSD];

      else output = convert[MSD] + convert[LSD];

    }

  }else{

    output=0;

  }

  return output;

}

 

function isNum(no, base){

  var cmp="0123456789";

  var chkStr=no;

  var chkChar;

  var rc=true;

  var nLen;

 

  if(base == 16){

    cmp+="ABCDEFabcdef";

  }else if(base == 10){

    eval("chkStr=''+parseInt(chkStr)");

  }

  nLen=chkStr.length;

 

  for(var i=0; i<nLen; i++){

     chkChar=chkStr.substring(i,i+1)

     if(i==0 && chkChar == "#" && base == 16){

     }else if(cmp.indexOf(chkChar)<0){

       rc=false;

     }

     if(rc == false) i=nLen;

  }

  return rc;

}

 

function chkNum(obj,base){

  var form=document.GradForm;

  var rc=true;

 

  if(base==10){

    eval("rc=form."+obj+".value <= 255");

  }

 

  if(rc){

    eval("rc=isNum(form."+obj+".value,"+base+")");

    if(!rc){

      alert("输入的数值不正确!");

      eval("form."+obj+".focus()");

    }

  }else{

    alert("输入的数值大于255");

    eval("form."+obj+".focus()");

  }

  return rc;

}

 

function twobyte(no){

  var str=no;

 

  if(isNum(no,16)){

    str="0"+str;

    str=str.substring((str.length-3)+1);

  }else{

    str="00";

  }

  return str;

}

 

function CstrLen(cStr){

  var sLen=cStr.length;

  var j=0;

  for(var i=0;i<sLen;i++){

     str=cStr.charAt(i);

     if(NS4 && str.charCodeAt(0)<1){

       i++;

     }

     j++;

  }

  return j;

}

 

function GradientText(form, color1, color2, color3, gStr, gType){

  var redStep, greenStep, BlueStep;

  var str_r, str_g, str_b, str;

 

  var gStep=CstrLen(gStr);

 

  var b1 = color1 % 0x100; if(isNaN(b1)) b1=0;

  var g1 = parseInt(color1 / 0x100) % 0x100; if(isNaN(g1)) g1=0;

  var r1 = parseInt(color1 / 0x10000) % 0x100; if(isNaN(r1)) r1=0;

 

  var b2 = color2 % 0x100; if(isNaN(b2)) b2=0;

  var g2 = parseInt(color2 / 0x100) % 0x100; if(isNaN(g2)) g2=0;

  var r2 = parseInt(color2 / 0x10000) % 0x100; if(isNaN(r2)) r2=0;

 

  var cStepAdd = parseInt(256 / gStep);

 

  if(g1 > g2){

    greenStep = 0;

  }else if(g2 > g1){

    greenStep = 1;

  }else{

    greenStep = 2;

  }

 

  if(r1 > r2){

    redStep = 0;

  }else if(r2 > r1){

    redStep = 1;

  }else{

    redStep = 2;

  }

 

  if(b1 > b2){

    BlueStep = 0;

  }else if(b2 > b1){

    BlueStep = 1;

  }else{

    BlueStep = 2;

  }

 

  var GradStr="";

  if(gType == 'S'){

    GradStr+='<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER BGCOLOR="'+color3+'"><br>';

  }

 

  for(var i=0; i<gStr.length; i++){

     str_r=twobyte(returnBase(r1,16));

     str_g=twobyte(returnBase(g1,16));

     str_b=twobyte(returnBase(b1,16));

 

     str=gStr.charAt(i);

     if(NS4 && str.charCodeAt(0)<1){

       str=str+gStr.charAt(i+1);

       i++;

     }

 

     GradStr+='<font color="#'+str_r+str_g+str_b+'">'+str+'</font>';

 

     if(redStep==1){

       r1 = r1 + cStepAdd;

       if(r1 > r2) r1 = r2;

     }else if(redStep==0){

       r1 = r1 - cStepAdd;

       if(r1 < r2) r1 = r2;

     }

       

     if(greenStep==1){

       g1 = g1 + cStepAdd;

       if(g1 > g2) g1 = g2;

     }else if(greenStep==0){

       g1 = g1 - cStepAdd;

       if(g1 < g2) g1 = g2;

     }

 

     if(BlueStep==1){

       b1 = b1 + cStepAdd;

       if(b1 > b2) b1 = b2;

     }else if(BlueStep==0){

       b1 = b1 - cStepAdd;

       if(b1 < b2) b1 = b2;

     }

  }

 

  if(gType == 'S'){

    GradStr+='<br>&nbsp;</TD></TR></TABLE>';

  }

 

  return GradStr;

}

 

function GenTag(form){

  var ss,ee,bb;

 

  if(!isNum(form.start.value,16)){

    alert("请检查起始颜色数值");

  }else if(!isNum(form.end.value,16)){

    alert("请检查结束颜色数值");

  }else if(!isNum(form.bg.value,16)){

    alert("请检查背景颜色数值");

  }else{

    eval("ss=0x"+form.start.value.substring(1)+";");

    eval("ee=0x"+form.end.value.substring(1)+";");

    eval("bb=form.bg.value");

    form.code.value=GradientText(form,ss,ee,bb,form.showstr.value,"C");

  }

}

 

function newRGB(type, field2){

  var form=document.GradForm;

  var chkOK=true;

  var vNo;

 

  if(field2==""){

    if(sItem=="S"){

      chkOK=chkNum('start',16);

    }else if(sItem=="E"){

      chkOK=chkNum('end',16);

    }else if(sItem=="B"){

      chkOK=chkNum('bg',16);

    }

  }

 

  if(chkOK){

    if(type==0){

      if(field2 != "") eval("chkOK=isNum(form.rgb_"+field2+".value,10)");

      if(chkOK){

        if(field2 != "") eval("chkOK=chkNum('rgb_"+field2+"',10)");

        if(chkOK){

          fstr_r=twobyte(returnBase(form.rgb_r.value,16));

          fstr_g=twobyte(returnBase(form.rgb_g.value,16));

          fstr_b=twobyte(returnBase(form.rgb_b.value,16));

          if(sItem=="S"){

            form.start.value="#"+fstr_r+fstr_g+fstr_b;

          }else if(sItem=="E"){

            form.end.value="#"+fstr_r+fstr_g+fstr_b;

          }else if(sItem=="B"){

            form.bg.value="#"+fstr_r+fstr_g+fstr_b;

          }

        }

      }else{

        alert("输入的颜色数值不正确。");

        eval("form.rgb_"+field2+"s.focus()");

      }

    }else{

      if(sItem=="S"){

        fstr_r=form.start.value.substring(1,3);

        fstr_g=form.start.value.substring(3,5);

        fstr_b=form.start.value.substring(5,7);

      }else if(sItem=="E"){

        fstr_r=form.end.value.substring(1,3);

        fstr_g=form.end.value.substring(3,5);

        fstr_b=form.end.value.substring(5,7);

      }else if(sItem=="B"){

        fstr_r=form.bg.value.substring(1,3);

        fstr_g=form.bg.value.substring(3,5);

        fstr_b=form.bg.value.substring(5,7);

      }

      form.rgb_r.value=parseInt(fstr_r,16);

      form.rgb_g.value=parseInt(fstr_g,16);

      form.rgb_b.value=parseInt(fstr_b,16);

    }

    if(chkOK) AddText();

  }

}

 

function AddText(){

  var form=document.GradForm;

  var ss,ee,bb;

 

  eval("ss=0x"+form.start.value.substring(1)+";");

  eval("ee=0x"+form.end.value.substring(1)+";");

  eval("bb=form.bg.value");

 

  str=GradientText(form,ss,ee,bb,form.showstr.value,"S");

  display("fsample", str);

}

 

function setRGB(id,no){

  var form=document.GradForm;

  var nid="rgb_"+id;

 

  if(id){

    var tmp=eval("parseInt(form."+nid+".value)+parseInt("+no+")");

    if(tmp<0) tmp=255;

    else if(tmp>255) tmp=0;

 

    eval("form."+nid+".value="+tmp);

  }

 

  fstr_r=twobyte(returnBase(form.rgb_r.value,16));

  fstr_g=twobyte(returnBase(form.rgb_g.value,16));

  fstr_b=twobyte(returnBase(form.rgb_b.value,16));

 

  if(sItem=="S"){

    form.start.value="#"+fstr_r+fstr_g+fstr_b;

  }else if(sItem=="E"){

    form.end.value="#"+fstr_r+fstr_g+fstr_b;

  }else if(sItem=="B"){

    form.bg.value="#"+fstr_r+fstr_g+fstr_b;

  }

 

  AddText();

}

 

function SetColor(clr){

  if(sItem=="S"){

    document.GradForm.start.value="#"+clr;

  }else if(sItem=="E"){

    document.GradForm.end.value="#"+clr;

  }else if(sItem=="B"){

    document.GradForm.bg.value="#"+clr;

  }

 

  ResetValue();

  AddText();

}

 

function set(swtch){

  if(swtch == 1) sItem="S";

  else if (swtch == 2) sItem="E";

  else if (swtch == 0) sItem="B";

  ResetValue();

}

 

function ResetValue(){

  var form=document.GradForm;

  var str_r, str_g, str_b;

 

  if(sItem=="S"){

    str_r=form.start.value.substring(1,3);

    str_g=form.start.value.substring(3,5);

    str_b=form.start.value.substring(5,7);

  }else if(sItem=="E"){

    str_r=form.end.value.substring(1,3);

    str_g=form.end.value.substring(3,5);

    str_b=form.end.value.substring(5,7);

  }else if(sItem=="B"){

    str_r=form.bg.value.substring(1,3);

    str_g=form.bg.value.substring(3,5);

    str_b=form.bg.value.substring(5,7);

  }

  form.rgb_r.value=parseInt(str_r,16);

  form.rgb_g.value=parseInt(str_g,16);

  form.rgb_b.value=parseInt(str_b,16);

}

 

function nomsg(){

  self.status="";

}

 

function myReset(){

  AddText();

}

 

//-->

</script>

 

 

 

 

第二步:把如下代码加入<body>区域中:

<form name=GradForm>

<table border=1><tr><td>

 <INPUT type=radio name=setitem value="bg" onClick="set(0)">背景色<input type=text name="bg" size=6 value="#FFFFFF" onChange="newRGB(1,'')">

<INPUT type=radio name=setitem value="start" onClick="set(1)" checked>起始色<input type=text name="start" size=6 value="#FF0000" onChange="newRGB(1,'')">

 <INPUT type=radio name=setitem value="end" onClick="set(2)">结束色<input type=text name="end" size=6 value="#0000FF" onChange="newRGB(1,'')">

</td></tr>

 

<tr><td>

<font color="#FF0000"></font> <input type="Button" value="+" onClick="setRGB('r',1)"><INPUT type=text name=rgb_r size=3 value=0 onChange="newRGB(0,'r')"><input type="Button" value="-" onClick="setRGB('r',-1)">

<font color="#009900">绿</font> <input type="Button" value="+" onClick="setRGB('g',1)"><INPUT type=text name=rgb_g size=3 value=0 onChange="newRGB(0,'g')"><input type="Button" value="-" onClick="setRGB('g',-1)">

<font color="#0000FF"></font> <input type="Button" value="+" onClick="setRGB('b',1)"><INPUT type=text name=rgb_b size=3 value=255 onChange="newRGB(0,'b')"><input type="Button" value="-" onClick="setRGB('b',-1)">

 

</td></tr>

 

<tr><td>

<TABLE BORDER=1 CELLSPACING=-1 CELLPADDING=1>

<TR>

<TD BGCOLOR="#FFFFFF"><a href="#" onClick="SetColor('FFFFFF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFFF00"><a href="#" onClick="SetColor('FFFF00');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFE000"><a href="#" onClick="SetColor('FFE000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFC000"><a href="#" onClick="SetColor('FFC000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFA000"><a href="#" onClick="SetColor('FFA000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF8000"><a href="#" onClick="SetColor('FF8000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF6000"><a href="#" onClick="SetColor('FF6000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF4000"><a href="#" onClick="SetColor('FF4000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF0000"><a href="#" onClick="SetColor('FF0000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#E00000"><a href="#" onClick="SetColor('E00000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#C00000"><a href="#" onClick="SetColor('C00000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFC0FF"><a href="#" onClick="SetColor('FFC0FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FFA0FF"><a href="#" onClick="SetColor('FFA0FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF80FF"><a href="#" onClick="SetColor('FF80FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF60FF"><a href="#" onClick="SetColor('FF60FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#FF00FF"><a href="#" onClick="SetColor('FF00FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#E000FF"><a href="#" onClick="SetColor('E000FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#C000FF"><a href="#" onClick="SetColor('C000FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A000FF"><a href="#" onClick="SetColor('A000FF');return false" onMouseOver="nomsg();return true">  </a></TD>

</tr><tr>

<TD BGCOLOR="#8000FF"><a href="#" onClick="SetColor('8000FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00FFFF"><a href="#" onClick="SetColor('00FFFF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00E0FF"><a href="#" onClick="SetColor('00E0FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00C0FF"><a href="#" onClick="SetColor('00C0FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00A0FF"><a href="#" onClick="SetColor('00A0FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#0080FF"><a href="#" onClick="SetColor('0080FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#0060FF"><a href="#" onClick="SetColor('0060FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#0000FF"><a href="#" onClick="SetColor('0000FF');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#0000E0"><a href="#" onClick="SetColor('0000E0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#0000C0"><a href="#" onClick="SetColor('0000C0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#D0FF00"><a href="#" onClick="SetColor('D0FF00');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A0FF00"><a href="#" onClick="SetColor('A0FF00');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#80FF00"><a href="#" onClick="SetColor('80FF00');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00FF00"><a href="#" onClick="SetColor('00FF00');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00E000"><a href="#" onClick="SetColor('00E000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00C000"><a href="#" onClick="SetColor('00C000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00A000"><a href="#" onClick="SetColor('00A000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#008000"><a href="#" onClick="SetColor('008000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#00A0A0"><a href="#" onClick="SetColor('00A0A0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A0A000"><a href="#" onClick="SetColor('A0A000');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A0A0A0"><a href="#" onClick="SetColor('A0A0A0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A0A0E0"><a href="#" onClick="SetColor('A0A0E0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#E0A0A0"><a href="#" onClick="SetColor('E0A0A0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#A0E0A0"><a href="#" onClick="SetColor('A0E0A0');return false" onMouseOver="nomsg();return true">  </a></TD>

<TD BGCOLOR="#000000"><a href="#" onClick="SetColor('000000');return false" onMouseOver="nomsg();return true">  </a></TD>

</TR>

</TABLE>

</td></tr>

 

<tr><td>

显示文字:<input type=text name="showstr" value="网页特效代码" onChange="AddText()">

</td></tr>

 

<tr><td>

<input type=hidden name="tempVal" value="">

代码如下:<br>

<TEXTAREA wrap=soft name=code COLS=62 ROWS=6"></TEXTAREA>

</td></tr><tr><td>

<INPUT TYPE="button" VALUE="生成代码" onClick='GenTag(this.form)'>

<INPUT TYPE="button" VALUE="预览效果" onClick='AddText()'>

<INPUT TYPE="reset" VALUE="全部清除">

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

</form>

</CENTER>

<SPAN ID="fsample" STYLE="position: absolute;left:280;top:460; color: black; font-weight: normal; font-size: 9pt">

<form name="fsample2">

起始颜色<input type=text name="startcolor" size=8 onfocus="this.blur()">

结束颜色<input type=text name="endcolor" size=8 onfocus="this.blur()">

</form>

</SPAN>

 

<SCRIPT LANGUAGE="JavaScript">

<!--

onload = myReset;

//-->

</SCRIPT>

 

0 Comments

Thu

05

Mar

2009

138、BrowserCheck脚本

138BrowserCheck脚本

脚本说明:

把如下代码加入<body>区域中:

<script>

 

function go(){

document.forms[1].scriptfield.value="<script>\n//BrowserCheck浏览器检测脚本生成器\n//luxiaoqing  http://www.k688.com/javascript/dai3.htm\n"

document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+"if ("+document.forms[0].version.value+"<=parseFloat(navigator.appVersion)){if (navigator.appName.indexOf('"+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+"')!=-1){if (4<=parseFloat(navigator.appVersion)){if ("+document.forms[0].width.value+"<=screen.width){if ("+document.forms[0].height.value+"<=screen.height){if ("+document.forms[0].depth.value+"<=screen.colorDepth){}else{error()}}else{error()}}else{error()}}}else{error()}}else{error()}"

if (document.forms[0].em.options[document.forms[0].em.selectedIndex].value=="popup"){

// document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+'window.alert("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+"版本"+document.forms[0].version.value+'以上。最佳分辨率 '+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix. '+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+",您的显示器属性和颜色数无法检测。")}'

document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+'function error(){if(parseFloat(navigator.appVersion)<4.00){window.alert("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+'以上。最佳分辨率 '+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix.'+document.forms[0].depth.value+'位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+",您的显示器属性和颜色数无法检测。")}else{window.alert("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+'以上。最佳分辨率 '+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix. '+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+", 分辨率"+screen.width+"x"+screen.height+" and "+screen.colorDepth+" 位色")}}\n</sc'+'ript>'}

else{

// document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+'document.write("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+'以上。最佳分辨率'+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix.'+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+",您的显示器属性和颜色数无法检测。")}else{error()}}'

// document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+'function error(){document.write("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+'以上。最佳分辨率'+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix. '+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+", 分辨率"+screen.width+"x"+screen.height+" and "+screen.colorDepth+" 位色")}\n</sc'+'ript>'}

document.forms[1].scriptfield.value=document.forms[1].scriptfield.value+'function error(){if(parseFloat(navigator.appVersion)<4.00){document.write("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+' 以上。最佳分辨率'+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix. '+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+",您的显示器属性和颜色数无法检测。")}else{document.write("本站推荐使用 '+document.forms[0].browser.options[document.forms[0].browser.selectedIndex].value+" "+document.forms[0].version.value+' or higher, 分辨率'+document.forms[0].width.value+'x'+document.forms[0].height.value+' pix. '+document.forms[0].depth.value+' 位色。您现在使用 "+navigator.appName+" "+navigator.appVersion+", 分辨率"+screen.width+"x"+screen.height+" and "+screen.colorDepth+" 位色")}}\n</sc'+'ript>'}

}

// )}

</script>

 <table border="0" width="100"

bgcolor="#9BADB8">

        <tr>

          <td

style="border-left: 5px groove; border-right: 5 groove; border-top:

5 groove; border-bottom: 5 groove"

align="center" height="646">

            <form method="POST">

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

                <tr>

                  <td width="123" align="right"><font color="#000000"

face="Arial"><strong><br>

                    Browser</strong></font></td>

                  <td width="310" align="left" valign="bottom"><font color="#000000" face="Arial"><br>

                    <select name="browser" size="1" style="font-family: MS Sans

Serif, Arial">

                      <option value="Microsoft Internet Explorer" selected>Microsoft

                      Internet Explorer</option>

                      <option value="Netscape">Netscape Navigator</option>

                    </select>

                    </font></td>

                </tr>

                <tr>

                  <td width="123" align="right"><font color="#000000"

face="Arial"><strong>Browser version</strong></font></td>

                  <td width="310" align="left"><font face="Arial">

                    <input

type="text" name="version" size="5"

value="4.0">

                    </font></td>

                </tr>

                <tr>

                  <td width="123" align="right"><font color="#000000"

face="Arial"><strong>Screen width</strong></font></td>

                  <td width="310" align="left"><font color="#000000"

face="Arial">

                    <input type="text"

name="width" size="5" value="800">

                    pixels</font></td>

                </tr>

                <tr>

                  <td width="123" align="right"><font color="#000000"

face="Arial"><strong>Screen height</strong></font></td>

                  <td width="310" align="left"><font color="#000000"

face="Arial">

                    <input type="text"

name="height" size="5" value="600">

                    pixels</font></td>

                </tr>

                <tr>

                  <td width="123" align="right" valign="top"><font

color="#000000" face="Arial"><strong>Screen depth</strong></font></td>

                  <td width="310" align="left"><font color="#000000"

face="Arial">

                    <input type="text"

name="depth" size="5" value="32">

                    bit <br>

                    <small><small>(32 bit colors 32 bit, for 16 bit colors 16

                    bit, for 256 colors 8 bit and for 16 colors 4 bit)</small></small></font></td>

                </tr>

                <tr>

                  <td width="123" align="right"><font color="#000000"

face="Arial">代码生成方式</font></td>

                  <td width="310" align="left"> <font color="#000000" face="Arial">

                    <select name="em" size="1" class="pt9">

                      <option value="popup">Alert pop-up message</option>

                      <option value="doc">Display error line in document</option>

                    </select>

                    </font></td>

                </tr>

                <tr>

                  <td width="123" align="right"><font face="Arial"></font></td>

                  <td width="310" align="left"><font color="#000000"

face="Arial">

                    <input type="button"

value="生成代码" name="make"

onClick="go()" class="pt9">

                    </font></td>

                </tr>

              </table>

            </form>

            <form method="POST">

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

                <tr valign="top">

                  <td width="425" height="363"> 将如下代码加入HTML<HEAD> 区:

                    <div

align="center">

                      <center>

                        <p><font

color="#000000">

                          <input type="button" value="选择代码"

name="selectbutton"

 

onClick="document.forms[1].scriptfield.focus();document.forms[1].scriptfield

.select()" class="pt9">

                          <br>

                          <textarea rows="15" name="scriptfield" cols="60"

class="pt9" wrap="VIRTUAL">

 

0 Comments

Thu

05

Mar

2009

137、浏览器检测生成器

137、浏览器检测生成器

脚本说明:

第一步:把如下代码加入<head>区域中:

<script language="javascript">

<!--

function createcodes(entry)

{

line="<script>version=parseInt(navigator.appVersion); browser='OTHER'; if (navigator.appName=='Netscape'){browser='NS'+version;} if (navigator.appName=='Microsoft Internet Explorer'){browser='MSIE'+version;} if (navigator.appVersion.indexOf('MSIE 3')>0) {browser='MSIE3';}";

with (document.detectform)

{

 if (MSIE3.value!="") {line=line+"if (browser=='MSIE3') {window.location='"+MSIE3.value+"'}";}

 if (MSIE4.value!="") {line=line+"if (browser=='MSIE4') {window.location='"+MSIE4.value+"'}";}

 if (MSIE5.value!="") {line=line+"if (browser=='MSIE5') {window.location='"+MSIE5.value+"'}";}

 if (NS3.value!="") {line=line+"if (browser=='NS3') {window.location='"+NS3.value+"'}";}

 if (NS4.value!="") {line=line+"if (browser=='NS4') {window.location='"+NS4.value+"'}";}

 if (NS5.value!="") {line=line+"if (browser=='NS5') {window.location='"+NS5.value+"'}";}

 if (OTHER.value!="") {line=line+"if (browser=='OTHER') {window.location='"+OTHER.value+"'}";}

 

}

line=line+"</script>"

 

entry.code.value=line;

}

//-->

</script>

 

第二步:把如下代码加入<body>区域中:

<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign="TOP">

  <tr>

    <td colspan=3 bgcolor="#6C6C6C"></td>

  </tr>

  <tr>

    <td height="3"></td>

    <TABLE align="CENTER">

      <tr>

        <td>

          <form name="detectform">

            <table align="center">

              <tr>

                <td></td>

                <td>

                  <div align="center">

                    <center>

                      <table border="1" width="100%">

                        <tr>

 

                          <td bgcolor="#CCCCDD" colspan="2"  width="100%">

                            <p>请输入各项连接

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#FFFFFF" colspan=2 align=left> </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#EEEEFF" colspan="">BROWSER</td>

                          <td bgcolor="#EEEEFF" colspan="">PAGE-URL</td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            3 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE3" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            4 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE4" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2"> MSIE

                            5 </font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="MSIE5" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            3</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS3" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            4</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS4" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">NETSCAPE

                            5</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="NS5" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td bgcolor="#E4E4E4" colspan=""><font color="#000000" size="2">OTHER

                            BROWSERS</font></td>

                          <td bgcolor="#E4E4E4" colspan="">

                            <input type="text" name="OTHER" size="25" value="http://www.yahoo.com">

                          </td>

                        </tr>

                        <tr align="center">

                          <td colspan="2" bgcolor="#C0C0C0" align="left">

                           

                              <input

              type="button" value="代码生成" name="B1" onClick="createcodes(this.form)" class="pt9">

                              <br>

                              <input type="reset" value="清除重选" name="B2" class="pt9">

                          </td>

                        </tr>

                      </table>

                    </center>

                  </div>

                </td>

                <td></td>

              </tr>

            </table>

          

            <table align="center">

              <tr>

                <td>

                  <table border="1" align="center">

                    <tr>

                      <td bgcolor="#CCCCDD" colspan="2">

                        <p>生成的代码如下:

                      </td>

                    </tr>

                   

                    <tr>

                    <tr>

                      <td bgcolor="#EEEEFF">

                        <div align="center">

                          <center>

                            <p>拷贝如下代码</p>

                          </center>

                        </div>

                      </td>

                    </tr>

                    <tr>

                      <td bgcolor="#EEEEEE">

                        <div align="center">

                          <center>

                            <p>

                              <textarea name="code" cols="45" rows="20" wrap="PHYSICAL" class="pt9">选择上面的项目生成代码

 

0 Comments

Thu

05

Mar

2009

136、动态按钮代码生成器

136、动态按钮代码生成器

脚本说明:

第一步:把如下代码加入<head>区域中:

 <SCRIPT LANGUAGE="JavaScript">

<!--

var a = 21

function create() {

 

        this.line = ''

}

 

function skrivut(formet) {

bild1 = formet.bilden.value;

bild2 = formet.bildtva.value;

kall1 = formet.srcen.value;

kall2 = formet.srctva.value;

bildnamn = formet.bildnmn.value;

widd = formet.widden.value;

hojd = formet.hojden.value;

 

line = new Array()

for(var i=1; i<=a; i++) { line[i] = new create() }

line[1] = '<html><head><title>Code  Window</title></head><body bgcolor="#FFFFFF">'

line[2] = '&lt;HTML&gt;&lt;HEAD&gt;<br>&lt;TITLE&gt;Title of your page&lt;/title&gt;<P>'

line[3] = '&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;<BR>&lt;!--<BR>/**luxiaoqing http://www.7stk.com/javascript/dai1.htm**/<BR>Browser = false ;<BR>if(navigator.appName.indexOf("Netscape") != -1)<BR>'

line[5] = '{ if( (navigator.appVersion.indexOf("3.") != -1) || (navigator.appVersion.indexOf("4.") != -1) )<BR>'

line[6] = ' Browser = true}<BR>'

line[7]='if(navigator.appVersion.indexOf("MSIE") != -1) { if( navigator.appVersion.indexOf("4.") != -1)<BR>'

line[8]='Browser=true}<BR>'

line[9]='if ( Browser == true) {<BR>'

line[10] = bild1+'= new Image();<BR>'

line[11] = bild1+'.src = "'+kall1+'";<BR>'

line[12] = bild2+' = new Image();<BR>'

line[13] = bild2+'.src = "'+kall2+'";<BR>}<P>'

line[14] = 'function byt(place, imgName) {<BR>'

line[15] = 'if (Browser == true) {<BR>'

line[16] = 'document[place].src =eval(imgName + ".src");<BR>'

line[17] = '} }<BR>'

line[18] = '//--><BR>'

line[19] = '</SCRIPT><P></HEAD><br><BODY><P>Here comes the link:<BR>'

line[20] = '<A HREF=".html" onMouseOver="byt(''+bildnamn+'',''+bild2+'')" onMouseOut="byt(''+bildnamn+'',''+bild1+'')">'

line[21] = '<IMG SRC="'+kall1+'" NAME="'+bildnamn+'" HEIGHT="'+hojd+'" WIDTH="'+widd+'" BORDER="0"></A>'

line[22] = '<P></BODY></HTML><P><FORM><INPUT TYPE="button" VALUE="关闭" OnClick="self.close()"></FORM></BODY></HTML>'

nyaWin = window.open('','utskrift','toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=0,copyhistory=0,width=600,height=400')

nytt ()

}

g = 0

function nytt() {

g++

nyaWin.document.writeln(line[g]);

if (g < (a+1)) nytt()

nyaWin.document.close()

g = 0

}

 

Browser = false ;

if(navigator.appName.indexOf("Netscape") != -1)

{ if( (navigator.appVersion.indexOf("3.") != -1) ||

(navigator.appVersion.indexOf("4.") != -1) )

{ Browser = true;

fredrik= new Image();

fredrik.src = "knapp1.gif";

sover = new Image();

sover.src = "knapp2.gif";

} }

 

function byt(place, imgName) {

if (Browser == true) {

document[place].src =eval(imgName + ".src");

} }

//-->

</SCRIPT>

 

第二步:把如下代码加入<body>区域中:

 <form>

  图片1的名字:

  <INPUT TYPE="text" NAME="bilden" class="pt9" value="mouseoutpic">

  <BR>

  图片1的路径:

  <INPUT TYPE="text" NAME="srcen" class="pt9" value="images/pic1.gif">

  <BR>

  图片1的宽度:

  <INPUT TYPE="text" NAME="widden" class="pt9" value="100">

  <BR>

  图片1的高度:

  <INPUT TYPE="text" NAME="hojden" class="pt9" value="50">

  <P> 图片2的名字:

    <INPUT TYPE="text" NAME="bildtva" class="pt9" value="mouseoverpic">

    <BR>

    图片2的路径:

    <INPUT TYPE="text" NAME="srctva" class="pt9" value="images/pic2.gif">

    <BR>

    操作的名字

    <INPUT TYPE="text" NAME="bildnmn" class="pt9" value="first_pic">

    <BR>

    <INPUT TYPE="BUTTON" VALUE="生成代码" OnClick="skrivut(this.form)" class="pt9">

 

</FORM>

<P>

<P>说明:图片1==mouse out时的图片,正常显示时。图片2==mouse over时的图片。图片的名字和操作的名字可以随便取。有所区别即可。

<P>2个图片的尺寸必须一致才可以。

 

 

1 Comments

Thu

05

Mar

2009

135、打开窗口向右移动

135、打开窗口向右移动

脚本说明:

第一步:把如下代码加入<body>区域中

<script>

<!-- Beginning of JavaScript -

// The name of the pop-up-window. Do not change it.

var popwindow

 

// The heiht of your pop-up-window (pixels)

var popwindowwidth=200

 

// The width of your pop-up-window (pixels)

var popwindowheight=200

 

// Distance to the top margin of the big window.

var popwindowtop=200

 

// The URL of the HTML-file that contains the content of the pop-up-window

var popwindowURL="http://www.7stk.com"

 

// Standstill-time (seconds)

var waitingtime=4

 

// Configure ths speed of the pop-up-window

var pause=20

var step=40

 

// Do not change this variable

var popwindowleft=-popwindowwidth-50

 

// Do not change this variable

var marginright

 

// Do not change this variable

var pagecenter

 

// Do not change this variable

var timer

 

waitingtime= waitingtime*1000

 

function showWindow() {

popwindow = window.open(popwindowURL, "popwindow", "toolbar=no,width="+popwindowwidth+",height="+popwindowheight+",top="+popwindowtop+",left="+(-popwindowwidth)+"");

if (document.all) {

marginright = screen.width+50

}

if (document.layers) {

marginright = screen.width+50

}

pagecenter=Math.floor(marginright/2)-Math.floor(popwindowwidth/2)

movewindow()

}

 

function movewindow() {

if (popwindowleft<=pagecenter) {

popwindow.moveTo(popwindowleft,popwindowtop)

popwindowleft+=step

timer= setTimeout("movewindow()",pause)

}

else {

clearTimeout(timer)

timer= setTimeout("movewindow2()",waitingtime)

}

}

 

function movewindow2() {

if (popwindowleft<=marginright) {

popwindow.moveTo(popwindowleft,popwindowtop)

popwindowleft+=step

timer= setTimeout("movewindow2()",pause)

}

else {

clearTimeout(timer)

popwindow.close()

}

}

 

// -->

</script>

第二步:把<body>区域中的内容改为

<body bgcolor="#fef4d9" onLoad="showWindow()">

 

0 Comments

Thu

05

Mar

2009

134、页面自动打开关闭

134、页面自动打开关闭

脚本说明:

第一步:把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function popupWin() {

text =  "<html>\n<head>\n<title>跳出窗口</title>\n<body>\n";

text += "<center>\n<br>";

text += "<a href='http://www.7stk.com' target='_blank'><h2>网页特效代码</h2></a>";

text += "</center>\n</body>\n</html>\n";

setTimeout('windowProp(text)', 3000);               // delay 3 seconds before opening

}

function windowProp(text) {

newWindow = window.open('','newWin','width=200,height=30');

newWindow.document.write(text);

setTimeout('closeWin(newWindow)', 5000); // delay 5 seconds before closing

}

function closeWin(newWindow) {

newWindow.close();                           // close small window and depart

}

//  End -->

</script>

 

 

 

第二步:把<body>中的内容改为:

<body bgcolor="#fef4d9" onLoad="popupWin()">

 

0 Comments

Thu

05

Mar

2009

133、不提示关闭窗口

133、不提示关闭窗口

脚本说明:

把如下代码加入<body>区域中

<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<param name="Command" value="Close">

</object>

<script language="JavaScript">function shutwin(){closes.Click();return;}</script>

<a href="javascript:shutwin();">关闭本窗口</a>

 

0 Comments

Thu

05

Mar

2009

132、动态打开全屏窗口

132、动态打开全屏窗口

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

// set the page to go to...

url = "http://www.7stk.com/fine/ch/c01.htm";

 

// set how fast to expand horizontally

// lower is slower

var speedX = 7;

 

// set how fast to expand vertically

// lower is slower

var speedY = 5;

 

// set background color of "Loading..." screen

var bgColor = "#000000";

 

// set text color of "Loading..." screen

var txtColor = "#FF80000";

 

// do not edit below this line

// ---------------------------

if (document.all) {

var wide = window.screen.availWidth;

var high = window.screen.availHeight;

}

function andBoom() {

if (document.all) {

var Boomer = window.open("","BoomWindow","fullscreen");

Boomer.document.write('<HTML><BODY BGCOLOR='+bgColor+' SCROLL=NO><FONT FACE=ARIAL COLOR='+txtColor+'>Loading...</FONT></BODY></HTML>');

Boomer.focus();

for (H=1; H<high; H+= speedY) {

Boomer.resizeTo(1,H);

}

for (W=1; W<wide; W+= speedX) {

Boomer.resizeTo(W,H);

}

Boomer.location = url;

} 

else {

window.open(url,"BoomWindow","");

   }

}

//  End -->

</script>

<a href="javascript:andBoom()">动态打开全屏窗口</a>

 

 

0 Comments

Thu

05

Mar

2009

131、本机和弹出窗口同时打开页面

131、本机和弹出窗口同时打开页面

脚本说明:

把如下代码加入<body>区域中

<SCRIPT LANGUAGE="JavaScript">

function adClick(ad, site) {

window.open(ad);

window.location = site;}

</script>

 <a href="javascript:adClick('http://www.sohu.com', 'http://www.163.com');">

  <b>同时打开两个页面</b></a>

 

0 Comments

Thu

05

Mar

2009

130、页面内部的导航窗口

130、页面内部的导航窗口

脚本说明:

把如下代码加入<body>区域中

<script>

 

var dragapproved=false

var minrestore=0

var initialwidth,initialheight

var ie5=document.all&&document.getElementById

var ns6=document.getElementById&&!document.all

 

function drag_drop(e){

if (ie5&&dragapproved&&event.button==1){

document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx

document.getElementById("dwindow").style.top=tempy+event.clientY-offsety

}

else if (ns6&&dragapproved){

document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx

document.getElementById("dwindow").style.top=tempy+e.clientY-offsety

}

}

 

function initializedrag(e){

offsetx=ie5? event.clientX : e.clientX

offsety=ie5? event.clientY : e.clientY

if (ie5)

document.getElementById("saver").style.display=''

 

tempx=parseInt(document.getElementById("dwindow").style.left)

tempy=parseInt(document.getElementById("dwindow").style.top)

 

dragapproved=true

document.onmousemove=drag_drop

}

 

function loadwindow(url,width,height){

if (!ie5&&!ns6)

window.open(url,"","width=width,height=height,scrollbars=1")

else{

document.getElementById("dwindow").style.display=''

document.getElementById("dwindow").style.width=initialwidth=width

document.getElementById("dwindow").style.height=initialheight=height

document.getElementById("dwindow").style.left=30

document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30 : document.body.scrollTop*1+30

document.getElementById("cframe").src=url

}

}

 

function maximize(){

if (minrestore==0){

minrestore=1 //maximize window

document.getElementById("maxname").setAttribute("src","restore.gif")

document.getElementById("dwindow").style.width=ns6? window.innerWidth-20 : document.body.clientWidth

document.getElementById("dwindow").style.height=ns6? window.innerHeight-20 : document.body.clientHeight

}

else{

minrestore=0 //restore window

document.getElementById("maxname").setAttribute("src","max.gif")

document.getElementById("dwindow").style.width=initialwidth

document.getElementById("dwindow").style.height=initialheight

}

document.getElementById("dwindow").style.left=ns6? window.pageXOffset : document.body.scrollLeft

document.getElementById("dwindow").style.top=ns6? window.pageYOffset : document.body.scrollTop

}

 

function closeit(){

document.getElementById("dwindow").style.display="none"

}

 

if (ie5||ns6)

document.onmouseup=new Function("dragapproved=false;document.onmousemove=null;document.getElementById('saver').style.display='none'")

 

</script>

<div id="dwindow" style="position:absolute;background-color:navy;cursor:hand;left:0;top:0;display:none" onMousedown="initializedrag(event)" onSelectStart="return false">

<div align="right"><img src="max.gif" id="maxname" onClick="maximize()"><img src="close.gif" onClick="closeit()"></div>

<iframe id="cframe" src="" width=100% height=100%></iframe>

<div id="saver" style="width:100%;height:100%;position:absolute;left:0;top:0;display:none"></div>

</div>

 

<script>

//Use below code to load DHTML Window as page loads

if (ns6) window.onload=new Function('loadwindow("http://www.7stk.com",600,400)')

else

loadwindow("http://www.7stk.com",600,400)

</script>

<a href="javascript:loadwindow('http://www.cctv.com',600,400)">中央电视台</a>

<a href="javascript:loadwindow('http://www.163.com',600,400)">网易</a>

 

0 Comments

Thu

05

Mar

2009

129、本身窗口移到打开窗口上面

129、本身窗口移到打开窗口上面

脚本说明:

把如下代码加入<body>区域中

<script

language="javascript">

{

 newwin=window.open("http://www.7stk.com","网页特效代码","width=750 height=650");

 newwin.blur();

}

</script>

 

0 Comments

Thu

05

Mar

2009

128、随机掉落的窗口

128、随机掉落的窗口

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript1.2">

 

//Specify rate of display (1/freq)

var freq=5

 

var random_num=Math.floor(Math.random()*freq)

if (random_num==0)

window.onload=initbox

var ie=document.all

var dom=document.getElementById

var ns4=document.layers

 

var bouncelimit=32 //(must be divisible by 8)

var curtop

var direction="up"

var boxheight=''

 

function initbox(){

if (!dom&&!ie&&!ns4)

return

crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin

scroll_top=(ie)? document.body.scrollTop : window.pageYOffset

crossobj.top=scroll_top-250

crossobj.visibility=(dom||ie)? "visible" : "show"

dropstart=setInterval("dropin()",50)

}

 

function dropin(){

scroll_top=(ie)? document.body.scrollTop : window.pageYOffset

if (parseInt(crossobj.top)<100+scroll_top)

crossobj.top=parseInt(crossobj.top)+40

else{

clearInterval(dropstart)

bouncestart=setInterval("bouncein()",50)

}

}

 

function bouncein(){

crossobj.top=parseInt(crossobj.top)-bouncelimit

if (bouncelimit<0)

bouncelimit+=8

bouncelimit=bouncelimit*-1

if (bouncelimit==0){

clearInterval(bouncestart)

}

}

 

function dismissbox(){

if (window.bouncestart) clearInterval(bouncestart)

crossobj.visibility="hidden"

}

 

 

</script>

<div id="dropin" style="position:absolute;visibility:hidden;left:250;top:100;width:500;height:300;background-color:#F5F5F5">

 

<div align="right"><a href="javascript:dismissbox()">[关闭窗口] </a></div>随机掉落的窗口

</div>

 

0 Comments

Thu

05

Mar

2009

127、只掉一次的窗口

127、只掉一次的窗口

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript1.2">

var ie=document.all

var dom=document.getElementById

var ns4=document.layers

 

var bouncelimit=32 //(must be divisible by 8)

var curtop

var direction="up"

var boxheight=''

 

function initbox(){

if (!dom&&!ie&&!ns4)

return

crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin

scroll_top=(ie)? document.body.scrollTop : window.pageYOffset

crossobj.top=scroll_top-250

crossobj.visibility=(dom||ie)? "visible" : "show"

dropstart=setInterval("dropin()",50)

}

 

function dropin(){

scroll_top=(ie)? document.body.scrollTop : window.pageYOffset

if (parseInt(crossobj.top)<100+scroll_top)

crossobj.top=parseInt(crossobj.top)+40

else{

clearInterval(dropstart)

bouncestart=setInterval("bouncein()",50)

}

}

 

function bouncein(){

crossobj.top=parseInt(crossobj.top)-bouncelimit

if (bouncelimit<0)

bouncelimit+=8

bouncelimit=bouncelimit*-1

if (bouncelimit==0){

clearInterval(bouncestart)

}

}

 

function dismissbox(){

if (window.bouncestart) clearInterval(bouncestart)

crossobj.visibility="hidden"

}

 

 

function get_cookie(Name) {

var search = Name + "="

var returnvalue = ""

if (document.cookie.length > 0) {

offset = document.cookie.indexOf(search)

if (offset != -1) {

offset += search.length

end = document.cookie.indexOf(";", offset)

if (end == -1)

end = document.cookie.length;

returnvalue=unescape(document.cookie.substring(offset, end))

}

}

return returnvalue;

}

 

function dropornot(){

if (get_cookie("droppedin")==""){

window.onload=initbox

document.cookie="droppedin=yes"

}

}

dropornot()

</script>

<div id="dropin" style="position:absolute;visibility:hidden;left:250;top:100;width:500;height:300;background-color:#F5F5F5">

 

<div align="right"><a href="javascript:dismissbox()">[关闭窗口] </a></div>

这是只掉一次的窗口

</div>

 

0 Comments

Thu

05

Mar

2009

126、打开全屏窗口1

126、打开全屏窗口1

脚本说明:

把如下代码加入<body>区域中

<script language="JavaScript">

window.open ("http://www.7stk.com/", "popwindow0", "height=100, width=330, top=20, left=15,fullscreen=1");

window.focus()

</script>

打开全屏窗口

 

0 Comments