First I make an index page containing frame and I named all frames as nasa google you tube etc .
then on search page
<input id="main_category_lan1" value="test" />
<a href="javascript:void(0)"
onmouseover="
window.open('http://nasasearch.nasa.gov/search?utf8=%E2%9C%93&affiliate=nasa&query='
+document.getElementById('main_category_lan1').value)", target="nasa">s</a>
<a href="javascript:void(0)"
onmouseover="window.open('https://www.youtube.com/results?search_query=lecture'
+document.getElementById('main_category_lan1').value)",target="google">e</a>
but this is not working ,every time it open in new tab. Also I want to open both the pages bye a single button.
What should I do? Thanks.
Pass _self in target.
Read this link for more info about target
http://www.w3schools.com/tags/att_base_target.asp
Related
Hello my Wonderful Developers, I need help on this
Let say my website is https://nkiri.pw/ and I want to click on a button or Link, I want my current page to be replace by this page https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3 and my present page should open another page automatically. How can I achieve this successfully ?
I was able to solve it by doing this:
<a role="button" id='mike' href="<?php echo "https://".$_SERVER['SERVER_NAME']."/" ?>" target="_blank" class="btn btn-primary">Primary</a>
<script>let linkElement = document.getElementById("mike"); linkElement.addEventListener("click", openNew);function openNew() {window.open("https://itinerarycarter.com/h9xdx19n?key=2053deb616c8b3ac8566b44a8ec7c092", "_self");}</script>
You are using a hyperlink. So you have a href="" in your html tag. You can also set the target (where the page should be opened) to _blank. This means, that the page will be opened in another tab. So if you write it like this:
href="https://nkiri.pw/" target="_blank"
It will open your current page in another tab. Then you can open the new page with js.
let linkElement = Document.getElementById("yourIdOfTheLinkElement");
linkElement.addEventListener(function() {
window.open("https://itinerarycarter.com/qm37kgvszd?key=7f255a06003c7158485ad05f1e9672f3", "_self");
});
<button type="submit" class="myButton" onclick="window.open('test.txt')">Money Dispenser</button>
Is the current code i have, and does not do anything at all when i click it. ( I want it to download test.txt to the computer or device of the user who cliked it)
I don't really understand what you are trying to achieve using a submit button, if it's not mandatory I'd use an <a>.
With pure HTML5 using the download attribute
<a href="test.txt" download>Money Dispenser</a>
Or with Javascript if you have to use a <button>
This has already been covered grealy in this question
But the gist of it is, create a function to download files as shown on that thread and add it to your <button>
<button onclick="donwloaURI('data:text/plain,Test', 'Test.txt')">Money Dispenser</button>
You can use the HTML download attribute to specify that the target will be downloaded when a user clicks on the hyperlink.
<a href="/download-file-path-here" download>
Money Dispenser
</a>
You can do using:
<a href="data:text/plain;charset=UTF-8,test.txt" download>Download</a>
I am trying through VBA to generate automatically a report from my bank's website.
I managed to reach the website and plug in my user id and password without any problem. I've reached the page where I can normally generate the report.
Now I have to simulate a click on the link... But I can't manage to do it.
Here is a screenshot of the website, with the HTML code of the link I have to click on to generate the report (Summary Report Copy).
Here is the HTML code of the link I need to click on:
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false" class="">Summary Report Copy</a>
I've tried this line of VBA code, but doesn't work:
IE.Document.getElementById("irCustomStepOne:headerDataTableId:23:reportnamestatus").FireEvent "onclick"
How can I click on this "Summary Report Copy" thanks to VBA?
Here is the complete HTML code of the part of the webpage where the link is located. Maybe I am not using the right ID?
<td width="290px">
<span id="irCustomStepOne:headerDataTableId:23:reportNmGrp">
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false">Summary Report Copy</a>
<a id="irCustomStepOne:headerDataTableId:23:reportnamePrint" href="#" style="float:left;display:none;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if (!onReportLink(\'23\')) return false;','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamePrint\':\'irCustomStepOne:headerDataTableId:23:reportnamePrint\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Print\'},\'_blank\')');return false">Summary Report Copy</a>
<span id="irCustomStepOne:headerDataTableId:23:rpId" style="float:left;display:none;">3368127</span>
</span>
</td>
This always worked for me. Try it please:
For each lnk in IE.Document.getElementByTagName("a")
If lnk.ID = "irCustomStepOne:headerDataTableId:23:reportnamestatus" Then
lnk.Click
Exit For
Next
You might have to wait for the page to be fully loaded. Something like
Do: VBA.DoEvents: Loop While IE.Busy ' wait for the page to load
Dim el 'As IHTMLElement
Set el = IE.Document.getElementById("irCustomStepOne:headerDataTableId:23:reportnamestatus")
If el Is Nothing Then el = IE.Document.querySelector("a[title='Summary Report Copy']")
If el Is Nothing Then MsgBox("Link not found!") : Exit Sub
el.click
Do: VBA.DoEvents: Loop While IE.Busy ' wait for next page to load
I try to parse some hidden information:
<a id="showInfoBtn" rel="nofollow" title="SomeTitle" href="some_link/some_hash"
onclick="return showInfo(event)">Info showed here after click</a>
When I manually click to this link, only get request to http://www.google-analytics.com appears at the firebug. And page not reloaded - only info showed as a link text.
How can I get info by scrapy?
I did not understand very well if what you're trying to get is to show some info inside the a tag or in other part of the page. But in any of the cases that will also depend on what does the showInfo() function return.
If the first case is what you need and showInfo() returns the text with the info, i believe this is what you're looking for:
<a id="showInfoBtn" rel="nofollow" title="SomeTitle" href="#" onclick="this.innerHTML=showInfo(event)">
Info showed here after click
</a>
Here's a demo with the example http://jsfiddle.net/P49Dv/ ;)
i need to open two links when a button is clicked in the html page. I figured it as by calling onclick function and creating anchor tag using createElement in Javascript. But how to include another link?? Is there a way to give a href in button tag??
You can simply do that with javascript
window.open(url1);
window.open(url2);
And if you want to open one of that links in curren window you can replace window.open by this
window.location = url1;
<input type="button" value="Double Clicker" onclick="window.open("http://www.google.com/"); window.open("http://www.youtube.com/");" />
see this link for further information,
You need to use a javascript event to make the page go somewhere
<input type="button" name="button1" value="Go To Url" onClick="window.navigate('URL')">
You can also use
location.href=" ";`
Try to see what the location object can do => http://www.w3schools.com/jsref/obj_location.asp
You should be able to load two tab.
why dont u use bootstrap
<a href="#" class="btn btn-default">
It displays a button with link going to what is mentioned in href