Please check a newbie's script [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Please check my script below.
Im trying to add some color to some of the text... this is what i have managed to work out thus far.. is it correct?
<center> You will be redirected to the number one proven training system in <span style="color:blue;font-weight:bold"> <span id="countdowntimer">12 </span> Seconds </span> </center>
<script type="text/javascript">
var timeleft = 12;
var downloadTimer = setInterval(function(){
timeleft--;
document.getElementById("countdowntimer").textContent = timeleft;
if(timeleft <= 0)
clearInterval(downloadTimer);
},1000);

Yes, the text of the countdown is blue if that is what you mean. Ifyou want to change the color when the timer runs out try something like...
if(timeleft <= 0)
clearInterval(downloadTimer);
document.getElementById("countdowntimer").style = "color:red";
You might find tools like https://jsfiddle.net/vnjgngo1/ helpful in the future. In this fiddle you can paste your code and html in two separate blocks.

Related

Using jQuery - By clicking a button change the text of a div [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last month.
Improve this question
I am working on a project in CodePen editor. My problem is: How to change the text of a element each time a hit the button ?
I have an array from which I am displaying random text on a div.
Thanks!
Try this:
let quots = [
'quot1',
'quot2',
//...
];
$(document).on('click', '#button', function(){
$('#quotBox').text(quots[Math.floor(Math.random() * quots.length)]);
});
This is for single text change. Not for array.
$(document).ready(function(){
$(".txtchange").click(function(){
$("p").text("New Text!");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<button class="txtchange">Change</button>
<p>A Simple Text.</p>

Detect Red Line in Html [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
In this table, there is red line.
http://www.data.jma.go.jp/obd/stats/etrn/view/monthly_s3_en.php?block_no=47830&view=1
How can I know if there is red line or not in the table from the html?
url = "http://www.data.jma.go.jp/obd/stats/etrn/view/monthly_s3_en.php?block_no=47830&view=1"
html = urllib2.urlopen(url).read()
soup = BeautifulSoup(html, "lxml")
table = soup.select_one("table.data2_s")
print table
how to detect red line from the program?
This table do not have red line.
http://www.data.jma.go.jp/obd/stats/etrn/view/monthly_s3_en.php?block_no=47831&view=1
I wanted to read both urls above, and test if there is red line or not using the program.
The class-names of the td-s would be a good indicator. Lined td-s have a different class than non-lined. You could check for existence of the class "data_1t_0_0_0" for example.
you could use the iframe like then you could read your iframe content like this:
$('#frame').load(function () {
setTimeout(function () {
alert($('#frame').contents().find('.data_1t_0_0_1l').length);
}, 2000);
});

I need html script for asking simple 1+2 = ? then delayed redirect [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want a html page with simple question 1 + 2 and when user puts 3 it delayed redirects to another url after 3 seconds?
Basically I want a code for this. I apologize if it's too broad or inapropriate. But I need help right now.
I do not recommed asking people to write code for you on StackOverflow because this is a community where you ask questions and it gets answered. With that being said, I am bored so I will help you.
Using HTML and JQuery, we have an input and a button. When the button is pressed, it runs the function testInput(), which checks if the value of the input is equal to three, then if it is we wait 3 seconds then redirect them. Here is a working snippet:
function testInput() {
var inputVal = $("#inputBox").val();
if (inputVal == "3") {
setTimeout(function(){
window.location.href = "anotherpage.html";
}, 3000);
} else {
alert("wrong");
}
}
function neverGunnaRun() {
alert("CHANGE THIS IN EVERY PAGE");
}
1+2 = <input id="inputBox" type="text"> <button onclick="testInput();">Test</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
EDIT: Change the "CHANGE THIS IN EVERY PAGE" in the alert function in every different page to something else, and it won't change a thing.

Firefox can't show pictures? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I made a website. In this website I want to show pictures dynamically.
It works very well in Chrome. However, I can't see the pictures in FireFox.
My code as follows:
the value of directory is pictures\Tom\2014-08-14-01-52-01\beautiful.jpg
function addpictures(array){
var frame = document.getElementById("show_pictures");
for(var i=0;i<array.length;i++){
var index = array[i].PICTURE.indexOf("pictures");
directory=array[i].PICTURE.substring(index,array[i].PICTURE.length);
var node = document.createElement("div");
// the value of directory is "pictures\Tom\2014-08-14-01-52-01\beautiful.jpg"
node.innerHTML = '<img src='+directory+' width="800" height="600" alt="\"/><br/><br/>';
frame.insertBefore(node);
}
}
<div id="show_pictures" align="center">
<p id="description"></p>
</div>
URLs use forward slashes, not backslashes.
Chrome is kind enough to fix that for you, which is why you didn't notice this earlier.
try
./pictures/Tom/2014-08-14-01-52-01/beautiful.jpg

Is there a way to edit the styling of the suggestions given when typing in an input tag? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
As the question suggests, is there a way to edit the styling of the drop down list of previously inputted text when typing in an input tag?
That is browser specific so no. Instead, you could build a custom system where you save the previously entered values in 'local storage' via javascript and then use an auto-complete library to display the previous entries how you like.
Some example code:
http://jsfiddle.net/R2TGL/
<input type="text" id="savedInput"/>
window.onload = function(){
$('#savedInput').autocomplete({
source:JSON.parse(localStorage.previousInputs)
});
$('#savedInput').change(function(){
if( localStorage.previousInputs == undefined ) {
localStorage.previousInputs = JSON.stringify([]);
}
var prevArray = JSON.parse(localStorage.previousInputs);
prevArray.push($(this).val());
localStorage.previousInputs = JSON.stringify(prevArray);
$('#savedInput').autocomplete({
source:JSON.parse(localStorage.previousInputs)
});
});
}