Answers for "how to link to a specific part of a page html"

50

javascript link to another page

window.location.href = "http://mywebsite.com/home.html";
Posted by: Guest on July-18-2019
0

javascript get all script tags on page

var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
  if (scripts[i].src) {
  	console.log(i, scripts[i].src);
  } else { 
    console.log(i, scripts[i].innerHTML);
  }
}
Posted by: Guest on December-11-2019
3

html a link to section on page

<!--1. create link tag with href containing "[#][section to direct] with name-->
<a href = #about-section>About</a>

<!--2. create identifier for the section you would like to navigate to with "id" = name-->
<section id = "about-section"> <h1>This is the about section</h1> </section>
Posted by: Guest on January-08-2021
7

link to section on page html

<!-- #top is the ID of the div where u wanna link to -->
<a href="#top">Go back to the top!</a>

<div id="top"></div>
Posted by: Guest on June-19-2020
-1

how to redirect to another page in javascript on submit type

<script type="text/javascript" language="javascript">
function redirect()
{
    window.location.href="login.php";
}
</script>
<form  name="form1" id="form1" method="post">  
    <input type="submit" class="button4" name="order" 
        id="order" value="Place Order" onclick="redirect();" >
</form>
Posted by: Guest on December-19-2019
0

html link to other part of the page

<h1><a href="#belowtext">Title here xD</a></h1>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<p id="belowtext">Your below text appears here when you click on the text above me you will be redirected to here</p>
Posted by: Guest on June-19-2021

Code answers related to "how to link to a specific part of a page html"

Code answers related to "Javascript"

Browse Popular Code Answers by Language