clicking a href does not work second time - html

I write 2 examples. at 1st example I can click a lot of time. But at 2nd example clicking does not work at second time . I mean clicking only possible 1 time.
Click me
Click me

This is the browser's behavior. When a browser sees a hashtag fragment at the end of the URL for the page it's currently on, it attempts to go to that place in the document rather than reloading the page again. It should jump to whatever element has the ID "menu" on it, or do nothing if that element is not found.
If the #menu part is meant to be the value of your location variable int he query string, you need to escape the hashtag so it is not treated as the fragment. Otherwise, your location variable is being set to empty and the entire #menu is being treated as the fragment.
Click me
In this case, however, I would recommend excluding the hashtag (#) from your values to avoid confusion.

Related

click icon and open target directly

I have a table in my wiki as below. Right now when I click on the red pdf icon it takes me to the file description page for the target file, myfile.pdf.
Instead, I want it to immediately open the myfile.pdf, not require 2 clicks to get it open.
Below is what that table cell entry looks like (1st row, 2nd col in the table). How do I modify it to do what i want?
[[Image:Pdf_icon.png|20px|link=File:myfile.pdf]]
You can use one of the following methods:
[[Image:Pdf_icon.png|20px|link=Special:FilePath/myfile.pdf]]
or
[[Image:Pdf_icon.png|20px|link={{filepath:myfile.pdf}}]]
The slight difference is that the first method links to an internal special page that automatically redirects to the file, and the second method generates a direct link to the file.

click through several links on webpage and extract information from each?

I have access a webpage with a list of several hyperlinks, each of which are unique. This is it:
webpage I have access to that lists names from top to bottom. Each name is unique and is a hyperlink. I would like to click on these hyperlinks one by one and extract info from the resulting webpage.
Say I click the first name, say Adam, it then brings me to the following webpage:
alt:this is a page of the user's profile and includes info such as name, email status and more
My goal is to create a program that clicks the name at the top, and then takes the email address and puts it in an excel spreadsheet on my local machine. And then goes back to the original page, clicks on the name directly below the name that was previously clicked on, and then takes this names resulting email and throws it in the spreadsheet.
for those looking at the pictures, i would like to click on 'Adam' and then put his email into a spreadsheet, then go back, and then click on 'Adrian' and then put his email into a spreadsheet, and so on and so forth down the list.
What do I need to do/learn to create a tool that will do this for me?
I know a bit of Java and a tiny bit of html. I've been trying to look for a solution but the most I can get is excel vba to click on the first name, but not much more. Even if I got the vba to click on all the names, it seems I would have to type in an instruction for the vba to find each unique name, and I dont see much point in doing that since its probably faster to just do this manually then.
As i'm not a programmer (but would like to be soon :)) I have had some trouble asking this question since I don't know any technical terms.
Any thoughts/advice on how to do this?
With javascript and a little php you could make this happen. Since it appears this is something running in the browser it would probably be your best bet.
Make your program click links js has the ability to activate links. You could
click on body load
the first link on the page,
then have a counter that counts each time you click a link.
`Find out how many links there are in the document:`
var x = document.links.length;`
`Get the URL of the first link (index 0) in the document:`
`var x = document.links[0].href;`
Click the link you want to click
$(function(){
$('#myLink').trigger('click');
})
now that your on the next page you need to grab the email address that is on this page. If you know the css just grab the string that is in the element. at this point you can use javascript to go back to the previous page.
<button onclick="goBack()">Go Back</button>
Now you are on the original page. Your counter is one number higher. Use the counter to click the next link and your program will repeat the process pushing the new email to your array.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
once the program runs out of links to click or hits the limit of your counter you will need to create a txt file with javascript. write your array to the file with PHP. You can do this with an ajax call.
make an AJAX call to your php file passing the array. php can then write to the file.
Here is an example of making a text file and writing to it with javascript
Following this logic you can fairly easy make an application that activates the links in order of a page, pushes the email address to an array as a string. Goes back to the previous page and continues the process till you have all the links. At this point your program will write all the data in the array to a file.

How to use pushState,replaceState and popState correctly?

I'm trying to use the history API but I can't get it working as I'd expect. I've look at several examples but they all appear to be doing something wrong. That is, this flow doesn't work as expected:
On new page call pushState
On popState load desired page
What I'm finding happens is that for #2 the URL is not modified to the old state (testing in Firefox). Unless I call pushState, or replaceState again the URL stays where it was. I'm also finding that somehow the first page ends up duplicated in the browser's history (holding down back I can see it).
How exactly should the history be used so that Back/Forward/Reload all work like a traditional page flow?
The problems I'm having relate to the use of an iframe in the page. Each change of the location of the frame creates a new history entry which messages with the desired history. To prevent this one must replace the iframe location instead of assigning a new one.
document.getElementById('content_frame').contentWindow.location.replace( new_path )
Location.replace doesn't create a history entry.

Forwarding to Anchor Tag After Using select

I've got a select list and I want people to be directed to id tags once they choose their respective options.
I know that I'm going to have to use some kind of onClick() but what is the JavaScript that I should use to forward to the anchor of the value?
See this answer: Programmatically scroll to an Anchor Tag
Basically...
onclick="document.getElementById('targetID').scrollIntoView(true);"
or
window.location.href = '#targetName';
However, it looks like at least some versions of IE don't recognize clicks on <options>, so you'll have to place the onclick code on the <select> instead. If you make the value of each option the #anchor you're going to (and remember, set the id of the anchors as well as the name), you should be able to get the value of the clicked option and then scroll to it. This will take a lot less code as well since you write one scrolling function in one click event, and then maintain the data of the option values.

clickable/hoverable element on webpage

When the user clicks on (or moves their mouse over) my tables' column headers, I will use JavaScript to popup a lengthier description of the data in that column.
However, in order to entice the user to move the mouse over (or click on) the column headers, I need to make them "look clickable". I think I've seen this done before using a HTML link that doesn't actually link anywhere, something like
Age
From a semantic markup point of view this seems like a bad approach, because the element isn't actually a link, I just want to make it look like a link, so that the user knows something will happen when they click on it.
Is there a better approach?
Thanks,
Don
One option is to use the CSS "cursor" property to make the cursor turn into the "hand" pointer that is typically used for links:
.myHeaderClass{
cursor: pointer;
}
If your page applies special styling to links (e.g. a different color) you could also do the same for these headers, of course.