HTML button event on click and release - html

I'm new on HTML and I need to understand some basic stuff for a project with the ESP01 wi-fi module. I would like to create a web page with a button and this one has to have a different behaviour according to if it is pressed or released.
I tried with this
<button onclick='location.href='/UP_ON'' onmouseup='location.href='/UP_OFF''>UP</button>
but it doesn't work.

try location.href
<button onclick='location.href=/?UP_ON' onmouseup='location.href=/?UP_OFF'>UP</button>

Related

Generate Amazon link for open side popup with pre-applied filters

Edit: Stackoverflow modify automatically the Amazon links when you click, so for see the popup, select, copy and paste the URLs in the browser.
On Amazon there is a link to open directly a side popup, like this:
https://www.amazon.com/dp/B07FKTZC4M/#aod (#aod open the popup)
where We can enter some filters. I tried different ways with no success to generate a link that open directly the site popup with new filter pre-applied.
So i need a link that open this page with "new filter" pre-applied:
I tried different solutions, but don't work, for example:
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new#aod
https://www.amazon.com/dp/B07FKTZC4M/ref=new#aod
https://www.amazon.com/dp/B07FKTZC4M/#aod_f_new=true
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new=true#aod
https://www.amazon.com/dp/B07FKTZC4M/ref=aod_f_new?ie=UTF8&f_new=true#aod
I see some informations on source page, maybe that help:
Question: Is there a way to create a link that open directly the side popup with new filter pre-applied? Maybe adding some parameters to the URL.
You can call a function in JavaScript with which you can change the z-index of the popup.
Something like this:
<button onclick="popup()" value="open popup">
Also make the popup. I am just making a rough one:
<div id="popup" style="z-index:1000; position: absolute;">Some code</div>
Remember to set the z-index at behind and the position. Then for JS i will make it simple in case you can't code JS
function popup(){
document.getElementById("popup").style.zIndex=-1;//basically changing the popup's z-index
}
This will just change the z-index of the popup which you must create yourself

Open URL in new browser tab when click on HTML button

I am designing a web site with CodeIgniter and I want to open some URL when user click on its buttons (URLs have to open in new tab).
I use this code and it works when you want to open URL in same tab, but I want the URL to open in a new tab. I don't want to use JavaScript function too.
<button type="button" onclick="location.href='http://google.com'">Google</button>
If you could change your button to be an anchor...
Google
Then you could add styling to your anchor... if this is even required.
Try something like this
<button type = "button" onclick = "location.href = window.open('link')"></button>

Make button enable in html5 from imacro

The button gets disable after one click and to click again i have to refresh the page. This is the html code to the button
/*<button class="btn btn-large center-block btnvote vote" id="765" disabled="disabled">Vote for me</button>*/
I want to make the button enable by using imacro by deleting this disabled="disabled" and click again by using macro.
Can any one help?
using javascript you can remove the disabled property:
document.getElementById('765').disabled = false;
you may need to have a quick search on how to run javascript in imacro if you don't already know how to do this.

HTML5 - When button is pressed open a window with options

At the moment i have a normal button:
Sign up
Instead of sending it to a link immediatly i want it to display a popup window with mutliple options like this:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_prompt
But instead of the textbox i would like it to display checkboxes with the site it will direct you to. (and you can only select one checkbox)
Quick example i made in paint:
http://oi57.tinypic.com/s5cvu1.jpg
Not sure if this is possible since i'm not experienced with working on websites.
Your question is very broad and I don't think SO is here to give you a tutorial but as a help for you to get started I suggest you check out window.open event that you will need to fire in order to open a pop up http://www.w3schools.com/jsref/met_win_open.asp then on the pop up window you will have to decide whether it's better to have a checkbox or a radiobutton, since you want that only one option is ticked and so on. I suggest you look on google for "pop ups getting started" and javascript. I hope that helps.
Use onclick method:
<a href="" class="button" onclick=Login(); >Sign up</a>
again define the method signup in Scrpt tag
<script>
Login()
{
}
</script>
For better understanding refer this example:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick
This is very simple example, alternatively, if u r aware of jquery, it will make your work very easy, going for jquery is better option.
http://jqueryui.com/dialog/

Make link using submit button

Can I link one page to another page using submit button?
It sends all the wrong signals to the user, but:
<form action="some-uri"><div><input type="submit"></div></form>
The problem with using a submit form is that the next page will think that it has to deal with a binary request, which you can't do if using an upload form.
So you are better using a image button (can make it look like a submit button) or using JavaScript...
Open in a new window:
onClick="window.open('page.html');"
Open in the same window:
onClick="document.location.href = ('page.html');"