qq_42296366 2021-04-22 17:01 采纳率: 20%
浏览 92

前端form引用样式为什么不成功?

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script> 
		<link rel="stylesheet" id="templatecss" type="text/css" href="css/basic-grey.css">
		
	</head>
	<body>		
	<div>
		<form action="" method="post" class="Basic-Grey" style="">
			<h1 style="">Contact Form<span>Please fill all the texts in the fields.</span></h1>
			<label>
				<span>Themplate :</span>
				<select id="template" name="themplate" onchange="changeStyle();">
					<option value="basic-grey">basic-grey</option>
					<option value="elegant-aero">elegant-aero</option>
					<option value="smart-green">smart-green</option>
					<option value="white-pink">white-pink</option>
					<option value="bootstrap-frm">bootstrap-frm</option>
					<option value="dark-matter">dark-matter</option>
				</select>
			</label>
			<label>
				<span>Your Name :</span>
				<input id="name" type="text" name="name" placeholder="Your Full Name" />
			</label>
			<label>
				 <span>Your Email :</span>
				 <input id="email" type="email" name="email" placeholder="Valid Email Address" />
			</label>
			<label>
				<span>Message :</span>
				<textarea id="message" name="message" placeholder="Your Message to Us"></textarea>
			</label>
			<label>
				<span>Subject :</span><select name="selection">
				<option value="Job Inquiry">Job Inquiry</option>
				<option value="General Question">General Question</option>
				</select>
			</label>
			<label>
				<span>&nbsp;</span>
				<input type="button" class="button" value="Send" />
			</label>
		</form>
	</div>
		
		
		<script>
			function changeStyle() {
				var template = document.getElementById("template");
				var index = template.selectedIndex;
				var templatevalue = template.options[index].value;
				var templatecss = document.getElementById("templatecss");
				templatecss.setAttribute("href","css/" + templatevalue + ".css");
				document.getElementsByTagName("form")[0].setAttribute("class",templatevalue);
				}
		</script>
	</body>
</html>


/* Basic Grey */
.basic-grey{
	margin-left:auto;
	margin-right:auto;
	max-width: 500px;
	background: # F7F7F7;
	padding: 25px 15px 25px 10px;
	font: 12px Georgia, "Times New Roman", Times, serif;
	color: # 888;
	text-shadow: 1px 1px 1px # FFF;
	border:1px solid # E4E4E4;
}
 .basic-grey h1{
	 font-size: 25px;
	 padding: 0px 0px 10px 40px;
	 display: block;
	 border-bottom:1px solid # E4E4E4;
	 margin: -10px -15px 30px -10px;;
	 color: # 888;
 }
.basic-grey h1>span{
	display: block;
	ont-size: 11px;
}
 .basic-grey label{
	 display: block;
	 margin: 0px;
 }
 .basic-grey label>span{
	 float: left;
	 width: 20%;
	 text-align: right;
	 padding-right: 10px;
	 margin-top: 10px;
	 color: # 888;
 }
 
.basic-grey input[type="text"], .basic-grey input[type="email"], .basic-grey textarea, .basic-grey select {
         border: 1px solid # DADADA;
         color: # 888;
         height: 30px;
         margin-bottom: 16px;
         margin-right: 6px;
         margin-top: 2px;
         outline: 0 none;
         padding: 3px 3px 3px 5px;
         width: 70%;
         font-size: 12px;
         line-height:15px;
         box-shadow: inset 0px 1px 4px # ECECEC;
         -moz-box-shadow: inset 0px 1px 4px # ECECEC;
         -webkit-box-shadow: inset 0px 1px 4px # ECECEC;
}
 
.basic-grey textarea{
 
         padding: 5px 3px 3px 5px;
 
}
 
.basic-grey select {
 
         background: # FFF url('down-arrow.png') no-repeat right;
 
         background: # FFF url('down-arrow.png') no-repeat right);
 
         appearance:none;
 
         -webkit-appearance:none;
 
         -moz-appearance: none;
 
         text-indent: 0.01px;
 
         text-overflow: '';
 
         width: 70%;
 
         height: 35px;
 
         line-height: 25px;
 
}
 
.basic-grey textarea{
 
         height:100px;
 
}
 
.basic-grey .button {
 
         background: # E27575;
 
         border: none;
 
         padding: 10px 25px 10px 25px;
 
         color: # FFF;
 
         box-shadow: 1px 1px 5px # B6B6B6;
 
         border-radius: 3px;
 
         text-shadow: 1px 1px 1px # 9E3F3F;
 
         cursor: pointer;
 
}
 
.basic-grey .button:hover {
 
         background: # CF7A7A;
 
}

为什么引用不成功啊,麻烦瞅一下,求求了

  • 写回答

8条回答 默认 最新

  • 关注

    form都是不显示的容器,不能引入样式吧。

    评论

报告相同问题?

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3