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 1 year ago.
Improve this question
I am trying to make a website wherein if the user clicks on a button, he/she gets directed to UN's website for more info. Please help are bare with me because I am very much new to coding.
Here is a basic example of creating a button that links to a new page when clicked (note: this will error when run on StackOverflow because of restrictions on the iframe used for Snippets, but it will work in other environments):
function setup() {
noCanvas();
let btn = createButton("Open");
btn.mousePressed(() => {
// This opens a link in a new window or tab:
window.open('https://stackoverflow.com/help/minimal-reproducible-example', '_blank');
});
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
Related
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 1 year ago.
Improve this question
How do I implement video keys on my website?
Like when I click a link, it generates an html page containing a specific type of content and gets deleted in certain amount of time.
I haven't done anything code yet.
My only solution is to hard code every html page not generating it.
I don't know how to make those like in YouTube where they can generate "watch?v=[key]" like that
thank you in advance :)
You can use window.open() open new window
const openWidow = ()=>{
var win = window.open("https://www.youtube.com/watch?v=Gjnup-PuquQ", 'window name', config = 'height=500,width=500');
}
also can use window.close() close this window
reference Window.open
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 3 years ago.
Improve this question
I have exactly this sidebar https://turbo87.github.io/sidebar-v2/examples/index.html and the source code of it I removed from that github https://github.com/Turbo87/sidebar-v2/blob/master/examples/index.html and as you can see when clicking on the marker it does not do any action, I tried in many ways to make it open when clicking in the marker and bring the content, if possible show me a command to make it open by clicking on the marker thanks.
You can try something like this to close/collapse the sidebar:
function showhidebar(){
button = document.getElementsByClassName('fa fa-bars')[0]
button.click()
}
map.eachLayer(function(l){if (l instanceof L.Marker) {l.on('click', showhidebar)}});
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 am a beginner in web developing world.
I have a table of data fetched from mysql database shown in php. Now I want to create a link on each row which on click will open up a new box (not window) of specific width-height and will show detailed information.
How can i do this ?
Think you searching for modals windows.
Here is example https://raventools.com/blog/create-a-modal-dialog-using-css-and-javascript
Create a div with css display:none;, and use javascript to toggle the visiblity. That might work.
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 want to redirect every third user of my website to another page.
For example in js html
window.location = "http://www.yoururl.com";
The reason behind this need, is to attempt to load balance my traffic
Every third user isn't possible without incorporating some kind of backend code on the server. But redirecting approximately one third of all visitors is possible.
if (Math.random() < 0.333333) window.location = "http://www.yoururl.com";
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 9 years ago.
Improve this question
I have a wordpress site, and have some good traffic, I want that, if a visitor come first time and click any where on the site, a new tab will open with my an other site.
Is this possible? if yes then what will be the code? i need code in javascript.
regards
Try this:
$(document).click(function() {
var win=window.open(url, '_blank');
win.focus();
});
Replace your <body> tag with this one:
<body onclick="window.open('http://google.com', '_blank')">
Over a link , we can give the address and the target so that the required URL opens in a new window.
Click Here