我发现了几个类似的问题,但它没有帮助我...所以我有这个问题:
var xxx = "victoria";
var yyy = "i";
alert(xxx.match(yyy/g).length);
Run Code Online (Sandbox Code Playgroud)
我不知道如何在match命令中传递变量.请帮忙.谢谢.
如何在HTML中将文本放在图像上.每当我输入以下代码时,文本都会出现在图像下方.
<img src="example.jpg">Text</img>
Run Code Online (Sandbox Code Playgroud) 我需要从框架集框架中访问和元素.例如,如果我有以下标记:
<frameset rows="33%,33%,*">
<frame src="frame1.html"/>
<frame src="frame2.html"/>
<frame src="frame3.html"/>
</frameset>
Run Code Online (Sandbox Code Playgroud)
如何从其中一个子框架中获取某些元素?我试过这个:
window.frames[1].getElementById('someElementId')
Run Code Online (Sandbox Code Playgroud)
这会导致类型错误:
getElementById()不是函数.
有人可以帮忙吗?
谢谢!
在我的程序中,我需要使用该if语句检查表中是否已存在数据库中的记录.使用c#我试图通过SQL连接来做到这一点.因为我认为该ExecuteNonQuery();命令返回一个整数值,如果我的假设是真的,我想知道什么值是真的知道表中是否存在某条记录.这是我的代码示例:
using (SqlConnection sqlConnection = dbUtil.GetSqlConnection(dbUtil.GetConnectionStringByName("NonConnectionString")))
{
using (SqlCommand sqlCommand = new SqlCommand("SELECT * from users where user_name like 'Adam' AND password like '123456'", sqlConnection))
{
sqlresult = sqlCommand.ExecuteNonQuery();
}
}
Run Code Online (Sandbox Code Playgroud)
考虑到sqlresult之前已经在main中进行了初始化,int sqlresult;
因此我想知道,如果这个用户'Adam'存在于数据库中,或者不存在.如果他存在,那么我想继续进行'if'语句,例如:
if(sqlresult == 0)
{
MessageBox.Show("Adam exists!");
}
Run Code Online (Sandbox Code Playgroud)
所以我只是不知道它应该返回的整数,我要么不确定这是正确的方法来做到这一点.
谢谢.
我正在使用jQuery 1.12.我想在我的窗口的URL查询字符串中替换查询字符串参数,或者如果之前不存在则添加参数.我试过以下:
new_url = window.location.href.replace( /[\?#].*|$/, "?order_by=" + data_val )
window.location.href = new_url
Run Code Online (Sandbox Code Playgroud)
但我发现的是,这会消除查询字符串中的所有先前参数,这是我不想要的.如果查询字符串是:
?a=1&b=2
Run Code Online (Sandbox Code Playgroud)
我希望新的查询字符串是:
?a=2&b=2&order_by=data
Run Code Online (Sandbox Code Playgroud)
如果查询字符串是:
?a=2&b=3&order_by=old_data
Run Code Online (Sandbox Code Playgroud)
它会变成:
?a=2&b=3&order_by=data
Run Code Online (Sandbox Code Playgroud) 我有一个活动的X控件,看起来像这样:
<object id="activeX" height="100%" width="100%" classid="myClass" >
<param name="name" value="myControlName" />
<param name="details" value="interestingDetails" />
<param name="a" value="a" />
<param name="b" value="b" />
</object>
Run Code Online (Sandbox Code Playgroud)
我没有在我的页面上显示这个html,而是想使用jquery小部件动态插入它.
我可以这样做:
myObject.id = "activeX";
myObject.height = "100%";
myObject.width = "100%";
myObject.classid = "myClass";
var param1 = document.createElement('param');
param1.setAttribute('name', 'name');
param1.setAttribute('value', 'myControlName');
myObject.appendChild(param1);
var param2 = document.createElement('param');
param2.setAttribute('name', 'details');
param2.setAttribute('value', 'interestingDetails');
myObject.appendChild(param2);
var param3 = document.createElement('param');
param3.setAttribute('name', 'a');
param3.setAttribute('value', 'a');
myObject.appendChild(param3);
var param4 = document.createElement('param');
param4.setAttribute('name', 'b');
param4.setAttribute('value', 'b');
myObject.appendChild(param4);
Run Code Online (Sandbox Code Playgroud)
然后将该对象附加到我页面上的某些内容中.
或者我可以简单地将html附加到我的页面,如:
$('#div').append('<object id="activeX" height="100%" width="100%" …Run Code Online (Sandbox Code Playgroud) 我收到以下错误.
错误
属性列表后面的SyntaxError:missing}
内容:Al futaim,贸易公司
<br />Building M,36,Saih Shuaib 3 -
PHP代码
$content=$servicecenter->getCompanyName()."<br />".$servicecenter->getAddress()."<br /><button type='button' value='Get Direction' class='button' onclick='closeInfoWindow(),calcRoute()' name='Get Direction'>Get Direction</button>";
Run Code Online (Sandbox Code Playgroud)
脚本
var infowindow = new google.maps.InfoWindow({
content:<?php echo $content; ?>;
});
Run Code Online (Sandbox Code Playgroud) 我有一个 html 画布,如下所示:
//output is a base64string of image data
var oldImage = new Image();
oldImage.onload = function () {
var resizeRatio = oldImage.width / 500;
var height = oldImage.height / 2;
};
oldImage.src = output;
var standardizedCanvas = document.createElement("canvas");
standardizedCanvas.setAttribute("width", "500px");
standardizedCanvas.setAttribute("height", height + "px");
standardizedCanvas.getContext("2d").drawImage(oldImage, 0, 0, frontCanvas.width, frontCanvas.height);
Run Code Online (Sandbox Code Playgroud)
这样我就可以将图像读入画布,然后获取图像数据。但这真正给了我什么?我需要byte[]画布中的一个,其中包含图像数据,所以我真的想将字符串转换base64为byte[]. 我走在正确的道路上吗,或者……?
这可能有一个非常明显的答案,但是我刚刚开始学习Java并发现了这一点。
说我们有
String x = "apple";
Run Code Online (Sandbox Code Playgroud)
为什么x.substring(5)返回"",并在x.substring(6)引发IndexOutOfBounds异常时为空字符串?是否可以在每个字符串后面附加某种空字符串?只是不确定它是如何工作的。
谢谢!
我想在javascript中创建这个html块:
<label>
<input name="{{ $amenity->name }}" type="checkbox" class="minimal">
text
</label>
Run Code Online (Sandbox Code Playgroud)
我有:
var checkBox = document.createElement("input");
var label_input = document.createElement("label");
label_input.innerHTML = value.name;
label_input.appendChild(checkBox);
Run Code Online (Sandbox Code Playgroud)
但结果是
<label>
text
<input name="{{ $amenity->name }}" type="checkbox" class="minimal">
</label>
Run Code Online (Sandbox Code Playgroud)
我试图先添加复选框然后再添加文本但没有成功.
javascript ×7
html ×3
jquery ×3
activex ×1
c# ×1
canvas ×1
frames ×1
frameset ×1
google-maps ×1
java ×1
match ×1
parameters ×1
php ×1
regex ×1
sqlcommand ×1
string ×1
url ×1
variables ×1