⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dai7.htm

📁 javascript各种效果的实例及源代码
💻 HTM
📖 第 1 页 / 共 3 页
字号:

                }



        }



        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>HTML代码:</b><br>



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



<INPUT TYPE="reset" VALUE= "清除内容" onClick="HjReset(this.form)">



</FORM>

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

<br>

<br>

<center>



<SCRIPT LANGUAGE="JavaScript">



<!-- hide

function goHist(a)

{

   history.go(a);

}

//-->

</script>

<FORM METHOD="post">

<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">

</form>

</center>

<br>

<center>

<textarea name=source rows=12 cols=55 class=yk9 onFocus="this.select()"  onMouseOver="this.focus()">

脚本说明:

把如下代码加入区域中:

<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>",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -