I click edit page on my google site and then add html box where i add this code
<button type="button" onclick="window.open('http://www.google.com','_blank','resizable=yes')" >Click to open Google</button>
But for some reason it doesn't work, although i tested it on some html editors and it worked.
Any ideas?
you can also try this
<input type="button" value="Click to open Google" />
It may be some kind of security feature, the code is correct, you can see it Here. But Here it doesn't work too.
You can try to use a link:
Click to open Google
Ps.: It's good to close all tags (</button> after button's text):
<button type="button" onclick="window.open('http://www.google.com','_blank','resizable=yes')" >Click to open Google</button>
Related
I need to disable double click on a button just using HTML. Is there any way to do it (without using javascript/jquery) ?
<button type="button" class="btn btn-default">Save</button>
Since HTML can't get the event of clicking sadly it's only possible with JS or such things that can find out click events.
Sadly you will be forced to use JavaScript to do this.
It's easy as that :
<form ...>
<input ...>
<button ... onclick="this.disabled=true;this.value='Submitting...'; this.form.submit();">
</form>
this is our code; we tried to link a page with a button, but the page is not opening,instead after clicking the button it redirects to the same page as the button.
The code for the button is:
<a href="search.html"><div class="form-group">
<button name="signup" class="btn btn-lg btn-primary btn-block" type="submit">Send Query</button></div></a>
Please help us debug this.
I think you should add your css classes on the link so it looks like a button Send Query
Your question is not clear at all, try this code,
Send Query
Make sure that you have placed the files in same directory?
And then Try this code :
<div class="form-group">
Signup
</div>
Then you may give your anchor tag look and feel same like button.
I wanna switch this code:
Inapoi
With a button. I want a button who redirect to ”selectare_gen.php”
I tried:
<button onclick="location.href='selectare_gen.php'">Inapoi</button>
But all it does is refreshing the current page..
It should be
<button type="reset" onclick="location.href='selectare_gen.php'">
Inapoi
</button>
The type="reset" is a workaround to prevent the browser from interpreting the button as a form element which causes the reload.
Check this link over here. It should answer your question.
How to create an HTML button that acts like a link?
Many browsers think that the <button> tag will cause a submit that's why it's appearing to just refresh the page. If you use an input type="button" it wouldn't have this effect:
<input type="button" onclick="window.location='selectare_gen.php';" value="Inapoi" />
I am working on a project, in which needs generation of bill. what is the code for which if we click a button then it will print a hard-copy for the user
try this:
<button onclick="window.print()">Print</button>
you can obviously use <a> or <input> and put onclick="window.print()" in there
You can do it using javascript...Try like this
<input type="button" value="Print This Page" onClick="window.print()" />
is it possible to use a button as an hyperlink in html. and it should be working for all the browsers?
If you want to separate content (html) from behaviour (JavaScript), as oppose to what Darrel suggested I would use:
<form action="http://www.google.com">
<input type="button" value="go to goole" />
</form>
Even thought this is not a form proper, it will work fine, and degrade gracefully when JS is disabled.
Not really a hyperlink per se but you can take the user elsewhere with a button.
<input type="button" value="Go To Google" onclick="window.location='http://google.com'" />
As a third alternative to the ones suggested here, you could use CSS to style a hyperlink to look like a button. If it works more like a link (goes somewhere, not performs an action), it may be better this way - for example, as far as I know, search engines may not always submit forms, but they would follow a link.
<form action="file1.php" method="get">
<button type="submit">Submit</button><br>
<button type="submit" formaction="file2.php">Submit to another page</button>
</form>