我想动态地将div id从html传递给js脚本,因为div id r1,r2,r3需要传入getElementById()
jS中,所以当用户将鼠标悬停在任何div上时,它会自动旋转.
这是我的第一个问题,如果有任何建议的修改,欢迎!
<tbody>
<tr>
<td id="r1"> Roboust</td>
<td id="r2">Dynamic</td>
<td id="r3">Adhere</td>
</tr>
<tr>
<td id="r4">Popular</td>
<td id="r5">Trending</td>
<td id="r6">Favourite</td>
</tr>
<tr>
<td id="r7">Famous</td>
<td id="r8">Blockbouster</td>
<td id="r9">Navie</td>
</tr>
</tbody>
</table>
<h1>CLICK ON BUTTONS TO ROTATE THE BUTTON AS YOU WANT THEM</h1>
<button onclick="rotate() ">Flip Row1</button>
<script>
var rotate = function() {
document.getElementById('r1').style="transform:rotateX(180deg);transition: 0.6s;transform-style:preserve-3d";
}
</script>
</body>
Run Code Online (Sandbox Code Playgroud) 我有两个checkbox
,取决于,哪个checkbox
用户点击,我需要调用其他功能,但是,我不能得到checkbox
标签值.
这是我的代码:
function getLabel(id)
{
return $("#"+id).next().text();
}
function BillStatus(){
console.log("its here");
var label=getLabel('checkboxid1');
console.log(label);
if(label=="No") {
//some function to call here
}else{
//other function to call here
}
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="check1">
<label>
<input type="checkbox" name="myCheckbox" id="checkboxid1" onclick="BillStatus()" style="visibility: visible"/>
Yes
</label>
</div>
<br>
<div id="check2">
<label>
<input type="checkbox" id="checkboxid2" name="myCheckbox" value="No" onclick="BillStatus()" style="visibility: visible" />
No
</label>
</div>
Run Code Online (Sandbox Code Playgroud)
我需要将生成的随机数从JS函数传递给html div,但是它无法传递它,这是我的代码片段
<html>
<head>
</head>
<body>
<button id="order" onclick="getRand()">orderId</button>
<div id="order_id"></div>
<script>
var getRand = function () {
var elem = Math.floor(Math.random() * 89999 + 10000);
document.getElementById("order_id").innerHTML = elem.value;
};
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个按钮,单击它会生成一个包含在段落文本中的数字,例如<p>random number <p>
,我想获取该随机数值并根据它生成的数字执行操作。从下面我需要获取34,756
数字并将其存储在 java 中,这是它的 html 代码:
<div class="form-group">
<div class="alert alert-count">
<p>
<b>
<!-- react-text: 531 -->
<!-- /react-text -->
<!-- react-text: 532 -->
34,756
<!-- /react-text -->
</b>
Run Code Online (Sandbox Code Playgroud)
我使用的xpath如下
String count = driver.findElement(By.xpath("//div[@class='alert alert-count']/p[1]/b).getText();
Run Code Online (Sandbox Code Playgroud)
但在控制台上它给出了错误
线程“main”中的异常 java.lang.NullPointerException
我有一个文本框,其中用户输入电子邮件地址,,
我想要实现的目标是设置background-color: green
用户输入的文本直到comma
,依此类推,在,
当前它直接将背景颜色应用于文本框之前,而不是只为逗号之前的每个文本添加文本本身
$('.team-btn').click(function() {
$('.team-intro').replaceWith($(".team-invite").clone().show());
$('#invite-emails').keydown(function(event) {
if (event.keyCode === 188) {
$(this).addClass('foo');
}
});
});
Run Code Online (Sandbox Code Playgroud)
.foo{
background-color:#0c0;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="team-intro">
<p>XXXX is a Free to use, Invite your team and get started today</p>
<button class="team-btn">Invite Now</button>
</div>
<div class="team-invite" style="display:none;">
<p>Enter emails and we will invite your mates to join you.</p>
<input type="text" id='invite-emails' name='email' placeholder='enter emails here' size="30">
<br>
<!--<div data-value="" id='style-email' style="padding-left: 12px; padding-right: 12px;">-->
<p id='subtext'>You …
Run Code Online (Sandbox Code Playgroud)我有日期字符串,如1900年12月25日星期二,我怎么能把它变成MM/dd/yyyy格式.我已经审阅了这个链接,但我的日期格式有一个解决方法.以下是我尝试的但是我得到了一个例外Unparsable date
.
String caseDate = "Tuesday , December 25th, 1900";
SimpleDateFormat inputFormat = new SimpleDateFormat("EEEE, MMMM dd Z yyyy");
Date date = inputFormat.parse(caseDate);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = formatter.format(date);
Utils.logtMsg("formattedDate "+formattedDate);
Run Code Online (Sandbox Code Playgroud)
例外
例外:::无法解释的日期:"1900年12月25日星期二"