首页 \ 问答 \ 表单提交按钮值[关闭](Form submit button value [closed])

表单提交按钮值[关闭](Form submit button value [closed])

<form action="mail.php" method="post" id="myform" name="myform" onsubmit="javascript:return validForm(document.myform)">
  <input type="submit" class=" " name='btnanother' id='btnanother' value='asdf'>
  <input type="text" class="txtinput" name="fname" id="fname" value="First &amp; Last Name" onblur="if(this.value==''){this.value='First &amp; Last Name'}" onfocus="if(this.value=='First &amp; Last Name'){this.value=''}">

  <input type="text" class="txtinput" name="phone" id="phone" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}">

  <input type="text" class="txtinput" name="email" id="email" value="Email Address" onblur="if(this.value==''){this.value='Email Address'}" onfocus="if(this.value=='Email Address'){this.value=''}">

  <input type="text" class="txtinput" name="location" id="location" value="Location" onblur="if(this.value==''){this.value='Location'}" onfocus="if(this.value=='Location'){this.value=''}">

  <input type="text" class="txtinput" name="sqrfoot" id="sqrfoot" value="Square Foot of Basement" onblur="if(this.value==''){this.value='Square Foot of Basement'}" onfocus="if(this.value=='Square Foot of Basement'){this.value=''}">

  <textarea name="describe" class="txtarea" id="describe" onblur="if(this.value==''){this.value='Describe your basement project'}" onfocus="if(this.value=='Describe your basement project'){this.value=''}">Describe your basement project</textarea>

  <div class="banner_captcha">
    <div class="banner_captcha_img">
      <img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg'>
    </div>
    <div class="banner_captcha_txt">
      <label for='message'>Enter the code here :</label>
      <br>
      <input id="letters_code" name="letters_code" type="text" value="">
    </div>
  </div>
  <br>
  <small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small>

  <div class="align-center">
    <input type="submit" class=" " name='btnanother' value='submit' style="text-indent:0px;" />
    <input type="submit" class=" " name='asfdas' value="asdfasdf" style="text-indent:0px;" />
    <input type="submit" class="submit" name='btnSubmit' value="asdf" style="text-indent:0px;" />

  </div>

在mail.php上没有获取提交按钮值。

如果我禁用了javascript,那么我将获得所有提交按钮值


<form action="mail.php" method="post" id="myform" name="myform" onsubmit="javascript:return validForm(document.myform)">
  <input type="submit" class=" " name='btnanother' id='btnanother' value='asdf'>
  <input type="text" class="txtinput" name="fname" id="fname" value="First &amp; Last Name" onblur="if(this.value==''){this.value='First &amp; Last Name'}" onfocus="if(this.value=='First &amp; Last Name'){this.value=''}">

  <input type="text" class="txtinput" name="phone" id="phone" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}">

  <input type="text" class="txtinput" name="email" id="email" value="Email Address" onblur="if(this.value==''){this.value='Email Address'}" onfocus="if(this.value=='Email Address'){this.value=''}">

  <input type="text" class="txtinput" name="location" id="location" value="Location" onblur="if(this.value==''){this.value='Location'}" onfocus="if(this.value=='Location'){this.value=''}">

  <input type="text" class="txtinput" name="sqrfoot" id="sqrfoot" value="Square Foot of Basement" onblur="if(this.value==''){this.value='Square Foot of Basement'}" onfocus="if(this.value=='Square Foot of Basement'){this.value=''}">

  <textarea name="describe" class="txtarea" id="describe" onblur="if(this.value==''){this.value='Describe your basement project'}" onfocus="if(this.value=='Describe your basement project'){this.value=''}">Describe your basement project</textarea>

  <div class="banner_captcha">
    <div class="banner_captcha_img">
      <img src="captcha_code_file.php?rand=<?php echo rand(); ?>" id='captchaimg'>
    </div>
    <div class="banner_captcha_txt">
      <label for='message'>Enter the code here :</label>
      <br>
      <input id="letters_code" name="letters_code" type="text" value="">
    </div>
  </div>
  <br>
  <small>Can't read the image? click <a href='javascript: refreshCaptcha();'>here</a> to refresh</small>

  <div class="align-center">
    <input type="submit" class=" " name='btnanother' value='submit' style="text-indent:0px;" />
    <input type="submit" class=" " name='asfdas' value="asdfasdf" style="text-indent:0px;" />
    <input type="submit" class="submit" name='btnSubmit' value="asdf" style="text-indent:0px;" />

  </div>

on mail.php not getting submit button value.

if i disabled javascript then i get all submit button value


原文:https://stackoverflow.com/questions/29123989
更新时间:2023-05-01 17:05

最满意答案

这是Sass @extend的实际行为和用例。

说明

为了清楚起见,请更新您的代码,如下所示

%red-color{
  color: red
}

@mixin btn-structure ($text-case: null, $text-shadow: null, $decoration: none ){
  display: inline-block;
  text: {
    decoration: $decoration;
    transform: $text-case;
    shadow: $text-shadow 
  }
}

.link-btn{
  @extend %red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

.test-class{
  @extend %red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

这会编译为,

.link-btn, .test-class {
  color: red;
}

.link-btn {
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

.test-class {
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

正如你所看到的, @extend用于“将一组CSS属性从一个选择器共享到另一个选择器”,可以将它们一起棍棒( .link-btn, .test-class )。 而@include用于插入任何需要的样式,而不是杵状。

根据您的要求,您可以使用@include并声明如下所示的mixin @mixin red-color

%red-color{
  color: red
}

@mixin red-color{
  color: red
}

@mixin btn-structure ($text-case: null, $text-shadow: null, $decoration: none ){
  display: inline-block;
  text: {
    decoration: $decoration;
    transform: $text-case;
    shadow: $text-shadow 
  }
}

.link-btn{
  @include red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

产量

而编译的CSS将是,

.link-btn {
  color: red;
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

希望这可以帮助。


This is the actual behaviour and a use-case of Sass @extend.

Explanation

To make it clear, update your code as below

%red-color{
  color: red
}

@mixin btn-structure ($text-case: null, $text-shadow: null, $decoration: none ){
  display: inline-block;
  text: {
    decoration: $decoration;
    transform: $text-case;
    shadow: $text-shadow 
  }
}

.link-btn{
  @extend %red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

.test-class{
  @extend %red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

Which would compile as,

.link-btn, .test-class {
  color: red;
}

.link-btn {
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

.test-class {
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

As you could see, @extend is used to "share a set of CSS properties from one selector to another", which can be clubbed together (.link-btn, .test-class). Whereas, @include is used to insert the styles where ever required, which is not clubbed.

Solution

For your requirement, you can resort to @include and declare a mixin @mixin red-color as below,

%red-color{
  color: red
}

@mixin red-color{
  color: red
}

@mixin btn-structure ($text-case: null, $text-shadow: null, $decoration: none ){
  display: inline-block;
  text: {
    decoration: $decoration;
    transform: $text-case;
    shadow: $text-shadow 
  }
}

.link-btn{
  @include red-color;
  @include btn-structure($text-case: 'uppercase', $decoration: underline);
}

Output

And the compiled css will be,

.link-btn {
  color: red;
  display: inline-block;
  text-decoration: underline;
  text-transform: "uppercase";
}

Hope this helps.

相关问答

更多
  • 我刚刚阅读了关于这个话题的好地方的Rubyist (顺便说一下这本书)。 作者做的更好,我的解释,我会引用他: 没有单一规则或公式总是导致正确的设计。 但是,在进行类与模块的决策时,请注意几点注意事项: 模块没有实例。 因此,实体或事物通常最好在类中建模,实体或事物的特征或属性最好封装在模块中。 相应地,如4.1.1节所述,类名称往往是名词,而模块名通常是形容词(Stack to Stacklike)。 一个类只能有一个超类,但是它可以混合在一个模块中。 如果您使用继承,请优先创建一个明智的超类/子类关系。 ...
  • 更新 Bootstrap现在有一个官方的Sass端口,可以在这里找到: https : //github.com/twbs/bootstrap-sass 以前 我找到了一个用sass编写的bootstrap版本,比在运行非rails应用程序的系统上安装ruby / compass / bootstrap-sass要容易得多。 https://www.github.com/jlong/sass-twitter-bootstrap 我从sass-twitter-bootstrap中复制了lib,并且只附加了主要 ...
  • 让我们看一下如果使用真实类而不是扩展类会发生什么 .a { .b { color: blue; } @extend .b; } 输出: .a .b, .a .a { color: blue; } 我可以想象你想要这样做的唯一原因是你可以使用extend类来扩展而不是.classname如下所示: .c { @extend .b; } 您会看到输出可能根本不是您想要的: .a .b, .a .a, .a .c { color: blue; } ...
  • 我最终在Building模型上创建了一个名为retrieve的静态方法,如下所示: BuildingSchema.static "retrieve", (id, cb) -> @ .findOne _id: id .exec (error, building) => return cb error if error building = building.toJSON() mixins = building.mixins or [] ...
  • 这是Sass @extend的实际行为和用例。 说明 为了清楚起见,请更新您的代码,如下所示 %red-color{ color: red } @mixin btn-structure ($text-case: null, $text-shadow: null, $decoration: none ){ display: inline-block; text: { decoration: $decoration; transform: $text-case; shado ...
  • 我已经测试了你的LESS,一切似乎都很好。 在元素上应用class1 ,我得到了重写的值。 请参阅此工作示例 。 所以我的猜测是你的问题出在其他地方 I've tested your LESS and all seems to be fine. When applying class1 on elements I've got the overridden values. See this working example. So my guess would be that your problem lie ...
  • 不,目前不支持此功能。 但它计划在未来版本中实施。 No, currently this is not supported. But it's planned to be implemented in future versions.
  • @mixin 这是mixin的工作原理 。 定义和用法: @mixin awesome { width: 100%; height: 100%; } body { @include awesome; } p { @include awesome; } 上面的代码段产生以下代码。 body { width: 100%; height: 100%; } p { width: 100%; height: 100%; } 为了让事情更有趣, 我们 ...
  • 我的快速测试似乎表明你可以毫不犹豫地覆盖mixins。 您不能将它们重新打开到允许您仅覆盖某些属性的程度,但您可以轻松地完全替换它们。 sample.sass: =test color: red font-weight: bold =test color: blue p +test sample.css: p { color: blue; } 请注意,此测试是使用Haml / Sass 3.0.2(Classy Cassidy)执行的,因此如果您之前收到错误,则可能不适用于早期版 ...
  • 不幸的是,这就是mixins的工作原理。 如果您想减小文件大小,我会考虑仅将mixin用于您要更改的属性,并使用常规扩展来实现不变的css规则。 @mixin btn-me($color: hotpink, $size: normal) { border: 1px solid $color; @if $size == 'small' { font-size: .8em; } @else { font-size: 1.2em; } &:hover { b ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)