小编Aks*_*kar的帖子

空输入字段的JavaScript验证

问候,我有这个输入字段, <input name="question"/>我想在提交点击提交按钮时调用IsEmpty函数.

我尝试了下面的代码,但没有奏效.有什么建议吗?!

<html>

<head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=unicode" />
  <meta content="CoffeeCup HTML Editor (www.coffeecup.com)" name="generator" />
</head>

<body>


  <script language="Javascript">
    function IsEmpty() {

      if (document.form.question.value == "") {
        alert("empty");
      }
      return;
    }
  </script>
  Question: <input name="question" /> <br/>

  <input id="insert" onclick="IsEmpty();" type="submit" value="Add Question" />

</body>

</html>
Run Code Online (Sandbox Code Playgroud)

javascript

82
推荐指数
6
解决办法
50万
查看次数

为什么我的 html 表单的密码输入字段有浅蓝色背景?

我有一个简单的表单,其中包含一个带有type="password". 该表单还包括一些其他输入字段。

由于某些疯狂的原因,Chrome 中的密码字段和输入字段具有浅蓝色背景。在 Firefox 中不是问题。当我将密码输入字段类型更改为“文本”即类型=“文本”时,背景为所需的白色。

哪个 css 规则负责此问题以及如何覆盖或禁用此规则?这是在 vue.js 文件中。

input[type="password"] {
  background-color: white;
}
Run Code Online (Sandbox Code Playgroud)
<div class="row">
  <div class="col-md-4">
    <div class="form-group">
      <label class="form-label">Password</label>

      <input type="password" class="form-control" name="example-text-input-invalid is-invalid" placeholder="Password" v-model="user.password" v-bind:pattern="passwordRulesRegex" v-bind:title="passwordRulesText" />
      <!-- <div class="col col-md-1"> -->
      <div class="invalid-feedback">Invalid feedback</div>
    </div>
  </div>
  <div class="col-md-8">
    <label class="form-label">&nbsp;</label>
    <small class="form-text text-muted mt-3">
            Enter a new password, or leave this blank to keep the existing password.
        </small>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

上面的样式没有效果...

html css forms vue.js

5
推荐指数
1
解决办法
3106
查看次数

Bulma CSS - 输入字段和选择元素之间的宽度不一致

我需要使用 Bulma 框架创建表单,但我在创建布局时偶然发现了输入/选择字段之间的宽度差异。

如下图所示: 在此处输入图片说明

如您所见,输入字段(1,插入名称)和选择元素(2,LABelos)之间存在差异,所以我的问题是如何修复选择的宽度以匹配上面输入字段的宽度(1,插入名称

这是代码:

<br />
<div class="columns">
  <div class="column is-4">
    <div class="columns is-desktop">

      <div class="column is-3">
        <p>
          <label>
                Awesome labelsss
              </label>
        </p>
      </div>
      <div class="column is-7">
        <div class="field">
          <div class="select">
            <select>
              <option>Select dropdown</option>
              <option>With options</option>
            </select>
          </div>
        </div>
      </div>
    </div>
    <div>
      <br />
      <div class="columns is-desktop">
        <div class="column is-3">
          <p>
            <label>
                  Some text
                </label>
          </p>
        </div>
        <div class="column is-7">
          <div class="field is-horizontal">
            <div class="field-body">
              <div class="field">
                <p class="control">
                  <input class="input" type="text" …
Run Code Online (Sandbox Code Playgroud)

html css bulma

5
推荐指数
1
解决办法
1479
查看次数

试图让我的待办事项列表 &lt;li&gt; 标签显示为一列但无法使其工作

我正在构建强制性的待办事项列表应用程序,但遇到了一个奇怪的样式问题。当我创建我的 li 时,我希望它们显示 inline-flex 和列,并堆叠在另一个之上。但是,它们当前在您创建时排列成一行显示。

我已经玩了很长一段时间了,但仍然无法弄清楚我是如何让它发挥作用的。我已经针对我试图让它工作的每个元素,但它不会正确显示。

有没有人知道我错过了什么?

https://codepen.io/constequalsexcel/pen/ZEGGoLq

function addTodo() {
  let node = document.createElement('li');
  node.setAttribute('class', 'list-item');
  let text = document.getElementById('todo-input').value;
  let textnode = document.createTextNode(text);
  node.appendChild(textnode);

  let deleteButton = document.createElement('button');
  let deleteButtonX = document.createTextNode('X');
  deleteButton.appendChild(deleteButtonX);

  let StrikeThroughRadio = document.createElement('input');
  StrikeThroughRadio.setAttribute('type', 'checkbox');
  StrikeThroughRadio.addEventListener('click', function(e) {
    if (StrikeThroughRadio.checked === true) {
      e.target.nextElementSibling.style.textDecoration = 'line-through';
      e.target.nextElementSibling.style.color = 'red';
    } else {
      e.target.nextElementSibling.style.textDecoration = 'none';
      e.target.nextElementSibling.style.color = 'black';
    }
  });

  deleteButton.addEventListener('click', function() {
    let deleteLI = document.getElementById('display');
    deleteLI.removeChild(node);
    let RemoveDeleteButton = document.getElementById('display');
    RemoveDeleteButton.removeChild(deleteButton);
    let …
Run Code Online (Sandbox Code Playgroud)

html javascript css

5
推荐指数
1
解决办法
55
查看次数

scrollIntoView() 将整个页面布局向上移动

当我们使用 scrollIntoView(true) 时,整个页面布局会向上移动。对于我的要求,我需要使用 true 参数。我需要避免这个举动。我在https://jsfiddle.net/7v4t31p0/ 中发布了此代码的工作副本,在此先感谢您。

.body {
  display: flex;
  width: 100%;
  border: 1px solid gray;
}

.left {
  flex: 0 0 200px;
}

.right {
  flex: 1 1 auto;
  border: 1px solid green;
}

.details {
  display: flex;
  width: 100%;
}

.links {
  display: flex;
  flex-direction: column;
}

.content {
  max-height: 100px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.content div {
  min-height: 100px;
}
Run Code Online (Sandbox Code Playgroud)
<div>
  <div>
    Header
  </div>
  <div class="body">
    <div class="left">
      Left panel
    </div>
    <div …
Run Code Online (Sandbox Code Playgroud)

html javascript css

1
推荐指数
1
解决办法
2497
查看次数

悬停时更改图标

我的导航栏图标如下,并且在悬停时我想显示不同的图标,这意味着由于许可证问题,无法使用蓝色引导图标中的相同图标。因此,将鼠标悬停以将图标更改为Alerts_torqHover.png时可以做什么

<div class="topbaricons">
  <img src="assets/icons/alerts_torq.png">
  <a><img src="assets/icons/alerts_torqHover.png"> </a>
</div>
Run Code Online (Sandbox Code Playgroud)

html css angular7

0
推荐指数
1
解决办法
73
查看次数

离子4-如何将模式背景更改为透明?

我正在尝试创建具有透明背景的模态,但是它不起作用

ion-content {
  --background-color: rgba(255, 255, 255, 0.7);
}

.closeBtn {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
}
Run Code Online (Sandbox Code Playgroud)
<ion-content padding>
  <h3 class="ion-text-center">
    <strong>Test.</strong>
  </h3>
  <ion-button class="closeBtn" color='light' fill='clear'>Close</ion-button>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

我希望看到一些透明性。

html css ionic-framework ionic4

0
推荐指数
2
解决办法
973
查看次数

标签 统计

css ×6

html ×6

javascript ×3

angular7 ×1

bulma ×1

forms ×1

ionic-framework ×1

ionic4 ×1

vue.js ×1