
<head>
<title>javascript怎么添加html标签</title>
<script src="jquery-171minjs"></script>
<script type="text/javascript">
$(function () {
//1、点击ID为add的元素 $("#add")click
//2、在第一个div中的 div:first
//3、最后的P元素下面的 p:last
//4、div中增加以下html 标签 after
$("#add")click(function () {
$("div:first p:last")after("<a>hello world!!!</a>");
});
});
</script>
</head>
<body>
<div>
<p>欢迎来到百度知道!!!</p>
<p><span>我们一起加油!</span><span><a id="add">添加</a></span></p>
<div>
<p>下面是增加的内容</p>
</div>
</div>
</body>
</html>用FTP登录到你的网站空间,下载首页文件,一般是indexhtml或defaulthtml或indexasp这类的文件名。
用记事本打开文件,找到<head>,把验证代码加到<head>后面,保存文件,用FTP重新上传到网站空间,覆盖原来的文件。<script type="text/javascript">
function check()
{ if(){ alert(''); return false;}}
</script>
<form id="form1" onSubmit="return check()">
</form>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)