HTML: Button that links to a .html file [duplicate] - html

This question already has answers here:
How do I create an HTML button that acts like a link?
(35 answers)
Closed 7 years ago.
I'm trying to make a button that links to a file (spaceRace.html), but I don't know how I would get the button to link to the file.
Please tell me what I should put in the button code.
<button type="button" onclick="">1 Player Mode</button>
Any help would be highly appreciated,

<input type = "button" style = "color:red; height:100px;width:125px; font-size:10px;font-family:'COMIC SANS MS' " value = "1 Player Mode"/>

Related

How to create a button on google slide that will trigger the insert image option? [duplicate]

This question already has answers here:
How to call a function via a link/button on a Google Slide?
(2 answers)
Closed 2 years ago.
I would like to know is there any way to add a button to google slide that will directly trigger the insert image option, so that user can directly insert the image by only clicking the button without going to the insert option in the top, is it possible to use script functionality ? then how ?.Please see this snapshot
https://developers.google.com/apps-script/guides/menus
That page explains how you can add UI elements. You can build a HTML and call app script functions from the HTML
<html>
<head>
<script>
function clickFunc(){
google.script.run.myFunctionNew();
}
</script>
</head>
<body>
<button onclick="clickFunc()">ADD IMAGE</button>
</body>
</html>
In your code.gs you can define myFunctionNew function to add image

Refresh the page after clicking on the area [duplicate]

This question already has answers here:
Button that refreshes the page on click
(18 answers)
Closed 3 years ago.
I want to refresh my website after clicking on a specific area (container)
Any ideas?
THANKS!
You can use Location.reload() API interface (https://developer.mozilla.org/ru/docs/Web/API/Location/reload)
So the answer could look as follows:
document.querySelector('you-area-selector-here').addEventListener((click) => {
window.location.reload(true);
})
true flag is required to be sure the page was reloaded from server, not from cache.
It is not a good practice to mix js with HTML.
I would do it this way:
let refreshPage = document.querySelector('#div1').addEventListener('click', => {
location.reload();
})
note: you must give id or class to the element you are trying to select in this function.
There are other way of doing it i.e = document.querySelectorAll, getElementById, getElementByClassName, getElementByTagName.

Is it possible to dynamically generate <p> in ASP.NET? [duplicate]

This question already has answers here:
dynamically add <p> tag in asp.net for comment system
(3 answers)
Closed 5 years ago.
Is it possible to dynamically generate <p> in ASP.NET code behind (VB)? I've been trying to find an example where <p> has been generated using HtmlGenericControl like the usual Dim div As New HtmlGenericControl("DIV")?
Thanks in advance!
You do it like this:
Dim p As HtmlGenericControl = New HtmlGenericControl("p")
p.InnerText = "The content goes here"
PlaceHolder1.Controls.Add(p)

Html text box that will redirect [duplicate]

This question already has an answer here:
Javascript URL Redirection based on a text box
(1 answer)
Closed 5 years ago.
m pretty terrible at web design and i just wanted to know how to make a text box that will redirect after putting in a certain phrase and pressing enter.
Thanks for help
This should work:
<form><input id="myInput" onblur="myFunction()" /></form>
<script>
function myFunction() {
if(document.getElementById('myInput').value == 'test') {
window.location.href='http://www.google.com';
}
}
</script>
See: https://codepen.io/anon/pen/gxLGgE

Internal Link (jump to link) [duplicate]

This question already has answers here:
How do I create an HTML button that acts like a link?
(35 answers)
Closed 7 years ago.
Is it possible to add an internal link (bookmark/jumpto) on a <button>
<button class="btn span3" id="save_progress" name="save_progress" value="1">Save Changes</button>
You can link to any element you like. Just give the element an id and set the URL to #that_id.
If you want to link from something, use a real link. It is what links are designed for. They do it really easily (and natively, and in a screen reader and search engine friendly fashion). If you want to link from something that looks like a button, then use a link and apply CSS to make it look like a button.
If you really, really want to use a button (hint: don't). Then you can bind JavaScript to it:
document.querySelector('#my_button').addEventListener('click', function (event) {
location = "#my_id";
});
Yes it is possible. Internal links don't have to point to an anchor tag.
you could use JavaScript to do something like that onclick="document.location+='#goToAnchor';return false;"
Doesn't seem like the best practice though.