能否找到应用于html中表格和表单使用的源代码

能否找到应用于html中表格和表单使用的源代码,第1张

Function FormatText(String) '''替换空格,尖括号,回车。可防html。

String=Server.HTMLEncode(String)

'String=Replace(String,"<","〈")

'String=Replace(String,">","〉")

String=Replace(String,CHR(32)," ")

String=Replace(String,CHR(13)&CHR(10), "<br>")

FormatText=String

End Function

Function FormatCode(String) '''完全原样,可防html,可用作显示源代码。

String="<xmp>"&String&"</xmp>"

FormatCode=String

End Function

Function FormatHTML(String) '''限制无法

使用on.....事件,无法使用JavaScript。

String=Replace(String,"onmouseover","0nmouseover",1,-1,vbTextCompare)

String=Replace(String,"onmouseout","0nmouseout",1,-1,vbTextCompare)

String=Replace(String,"onmousedown","0nmousedown",1,-1,vbTextCompare)

String=Replace(String,"onmouseup","0nmouseup",1,-1,vbTextCompare)

String=Replace(String,"onmousemove","0nmousemove",1,-1,vbTextCompare)

String=Replace(String,"onclick","0nclick",1,-1,vbTextCompare)

String=Replace(String,"ondblclick","0ndblclick",1,-1,vbTextCompare)

String=Replace(String,"onkeypress","0nkeypress",1,-1,vbTextCompare)

String=Replace(String,"onkeydown","0nkeydown",1,-1,vbTextCompare)

String=Replace(String,"onkeyup","0nkeyup",1,-1,vbTextCompare) '各种事件

String=Replace(String,"Script:","Script:",1,-1,vbTextCompare) 'JavaScript:,JScript:VBScript:

String=Replace(String,"<script","<xmp><script",1,-1,vbTextCompare)

String=Replace(String,"</script>","</script></xmp>",1,-1,vbTextCompare) '<script>...</script>标签

FormatHTML=String

End Function

Function FormatHTMLEx(String) '''不作任何限制

FormatHTMLEx=String

End Function

Function FormatSQL(String) '''防止sql语句出错

String=Replace(String,"'","''")

FormatSQL=String

End Function

代码(大小有需要可以调):

<!DOCTYPE html>

<html>

    <head>

        <meta charset="utf-8">

        <title>练习使用HTML</title>

    </head>

    <body>

        <center>

            <table border="1px" cellpadding="0px" cellspacing="0px">

                <tr>

                    <td colspan="4" height="60px"></td>

                </tr>

                <tr>

                    <td width="200px" height="60px"></td>

                    <td width="200px" height="60px"></td>

                    <td width="200px" height="60px"></td>

                    <td width="200px" height="60px"></td>

                </tr>

                <tr>

                    <td colspan="4" height="60px"></td>

                </tr>

                <tr>

                    <td colspan="4" height="60px"></td>

                </tr>

                <tr>

                    <td colspan="4" height="60px"></td>

                </tr>

                <tr>

                    <td colspan="4" height="60px"></td>

                </tr>

            </table>

        </center>

    </body>

</html>

运行效果:

你好,我按照你的要求写的如下代码,可以直接运行.

<center>

<table>

<caption style="text-decoration:underlinefont-weight:bold">请留下个人资料</caption>

<tr><td>姓名:</td><td><input type="text"></td></tr>

<tr><td>电话:</td><td><input type="text"></td></tr>

<tr><td>E-mail:</td><td><input type="text"></td></tr>

<tr><td>性别:</td><td><input type="radio" checked>男 <input type="radio">女</td></tr>

<tr><td>年龄:</td><td><select><option>20以下</option></select></td></tr>

<tr><td>留言版:</td><td><textarea></textarea></td></tr>

<tr><td>您的爱好:</td><td><input type="checkbox">运动 <input type="checkbox">阅读<br><input type="checkbox">听音乐 <input type="checkbox">旅游</td></tr>

</table>

<input type="submit" value="提交"> <input type="reset" value="全部重写">

</center>

<div>标题内容:<input type="text" id="a"></div><div>标题格式:<input type="text" id="b"></div><div>标题大小:<input type="text" id="c"></div><button type="button" id="d">预览</button><div id="e"></div>

// 绑定 id 为 d 的按钮的点击事件document.getElementById("d").onclick = function () {    // 获取 id 为 a 的输入框的值    var a = "标题内容:" + document.getElementById("a").value    // 获取 id 为 b 的输入框的值    var b = "标题格式:" + document.getElementById("b").value    // 获取 id 为 c 的输入框的值    var c = "标题大小:" + document.getElementById("c").value    // 将获取到的值加入到 id 为 e 的元素里面    document.getElementById("e").innerHTML = a + "" + b + "" + c}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6200659.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-17
下一篇 2023-03-17

发表评论

登录后才能评论

评论列表(0条)

保存