我的网站上有一个富文本编辑器,我正在尝试为它创建一个可靠的文字计数器.
因为它是一个富文本编辑器,它(可能)包含html.
这个html可能是,例如:
<div class="textEditor">
<h1><strong>this is a sample heading</strong></h1>
<p><br></p>
<p>and this is a sample paragraph</p>
</div>
Run Code Online (Sandbox Code Playgroud)
为了获得可靠的单词计数,我试图首先使用以下方法将html转换为文本:
var value = $('.textEditor').text()
Run Code Online (Sandbox Code Playgroud)
我面临的问题是返回的字符串似乎连接在哪里删除html标签,我剩下的是:
this is a sample headingand this is a sample paragraph
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,'heading'和'这两个词被加入成为'headingand',它会给我一个10而不是11的字数.
任何关于如何正确实现这一点的想法将非常感谢:)
使用 MVC 包装器,我尝试将默认过滤器从“等于”更改为“包含”。我找到了一些例子,但它们都没有达到我想要的效果(或者我错误地使用了它们......)
好的,这是我的代码:
@(Html.Kendo().Grid<Portal2.Areas.Coord.Models.ViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.OperationKey).Hidden();
columns.Bound(c => c.Customer).Hidden();
columns.Bound(c => c.CarNumber).Filterable(ftb => ftb.UI("CarFilter"));
columns.Bound(c => c.DriverName).Filterable(ftb => ftb.UI("DriverFilter"));
columns.Bound(c => c.PhoneNumber).Filterable(ftb => ftb.UI("PhoneFilter"));
})
.Filterable(f => f.Extra(false))
.DataSource(dataSource => dataSource
.Ajax()
.Read(r => r
.Action("Read", "Operations2", new { startTime = (DateTime)ViewBag.startTime, endTime = (DateTime)ViewBag.endTime })
)
.PageSize(20)
.ServerOperation(false)
)
.HtmlAttributes(new { style = "height: 740px" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(10)
)
)
Run Code Online (Sandbox Code Playgroud)
我有js函数:
function Filter(element, atr) {
var …Run Code Online (Sandbox Code Playgroud) 使用 jQuery UIMonthPicker http://jsfiddle.net/kidsysco/JeZap/,我在尝试月份选择事件时遇到困难。onClose 或 onSelect 函数均无响应。这是我的代码:
j$ = jQuery.noConflict();
j$(document).ready(function() {
j$('#txtDate').MonthPicker({
ShowIcon: false,
MaxMonth: 0,
MinMonth: -120,
onSelect: function() {
alert(j$("#txtDate").val());
}
});
j$("#txtDate").keydown(false);
j$("#txtDate").change(function(){
alert(j$("#txtDate").val());
});
});
Run Code Online (Sandbox Code Playgroud) 我有两个选择选项,一个是类别,第二个是子类别,我从MySQL获取了第一个选择选项,现在我想通过使用查询根据所选类别获取子类别.
喜欢 select cat_name form DB1 where id= ID_OF_SELECTED CATEGORY
<div class="form-group">
<label style="align-content:center" for="inputdefault">Select a category</label>
<?php
$sql = "SELECT * from noorizone.categories where parent=''";
$result = $con->query($sql);
// output data of each row
echo "<select class='form-control' id='sel1' onchange='getSubCategory()'>";
while($row = mysqli_fetch_array($result))
{
echo "<option value=".$row["id"].">".$row["name"]."</option>" ;
}
$maincat= $row["id"];
echo "</select>"
?>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我获取主类别值的代码.我知道它可能使用AJAX请求,但我不知道ajax.
你能帮我解决一下我的问题吗?
有谁知道为什么有时甲骨文对null价值观有奇怪的行为?
例如,当我选择以下查询时,第一行被排除,但 null 显然不像“Test”字符串:
SELECT A.NAME FROM (
SELECT NULL AS NAME FROM DUAL
UNION SELECT 'Name 1' AS NAME FROM DUAL
UNION SELECT 'Name 2' AS NAME FROM DUAL
UNION SELECT 'Name 3' AS NAME FROM DUAL
UNION SELECT 'Name 4' AS NAME FROM DUAL
UNION SELECT 'Name 5' AS NAME FROM DUAL
) A WHERE UPPER(A.NAME) NOT LIKE UPPER('Test') --THIS RULE EXCLUDE DE FIRST ROW WITH NAME NULL NULL NAME
Run Code Online (Sandbox Code Playgroud)
我使用的是 Oracle 版本 11:
Oracle Database …Run Code Online (Sandbox Code Playgroud) 正如您从标题中知道的那样,我想为我的音乐播放器网站自定义通知。默认 chrome 通知仅包含播放/暂停按钮。有什么方法可以自定义它以添加下一个/上一个按钮或我自己的自定义按钮。
我想为此实现 javascript 或 Jquery。
这是网站我正在谈论的
移动设备上的通知栏,例如:
如果我点击页面 A 中的一个按钮,浏览器将重定向到页面 B。在页面 B 中,如果我再次单击另一个按钮,它会重定向到页面 A。这里我曾经window.location.href重定向新页面。
例如:window.location.href="http:\\localhost:12345\index2.html"
是重定向下一页的任何其他替代方法。我不想使用windows.location
更新:
如果我使用windows.location我来自的 url 存储在 document.reffer. 出于安全目的,我不想允许存储 url。
我的程序设置为让用户猜测1到10之间的整数.如果用户猜测太低或高,他们会收到通知并可以再试一次.
我遇到的问题是,当用户猜错时,会生成一个新的随机数.因此,基本上用户在错误之后永远不会尝试猜测相同的数字.
我需要这样做,以便当用户猜错时,他们仍在尝试猜测相同的值.
这是我的代码:
namespace IntegerGame
{
public partial class guessGame : Form
{
int num1;
int num2;
public guessGame()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void guessButton_Click(object sender, EventArgs e)
{
Random rnd1 = new Random();
num1 = rnd1.Next(1, 10);
if (int.TryParse(textBox1.Text, out num2))
{
if (num2 < 0 || num2 > 10)
{
textBox1.Clear();
MessageBox.Show("Please enter a number between 1 and 10");
}
else
{
if (num2 > num1)
{
textBox1.Clear();
MessageBox.Show("You …Run Code Online (Sandbox Code Playgroud) javascript ×5
jquery ×5
html ×4
ajax ×1
angularjs ×1
asp.net-mvc ×1
audio-player ×1
c# ×1
filter ×1
html5-audio ×1
jquery-ui ×1
kendo-grid ×1
kendo-ui ×1
oracle ×1
oracle11g ×1
php ×1
random ×1
redirect ×1
sql ×1
string ×1
winforms ×1