我在网页设计和HTML,JS,CSS方面略显新鲜。
- 我创建了一个包含基本标题,导航栏,图像滑块和基本部分的页面。首页看起来像这个atm; http://i65.tinypic.com/98a4gh.jpg
我想打开"程序" 部分作为一个空页面,只有相同的标题。所以我复制了代码并创建了一个新的html文件并将其链接到& #34;程序"
private static void setValues(string[] arr, ref string test)
{
arr[1] = "BBB";
test = "222";
}
如您所知它在空白正文的相同标签中打开新的html文件(" example.html#section1" 包含空体) (http://i68.tinypic.com/dorzfk.png)
问题是; 是否可以创建该部分的直接链接(使用任何语言)?。我的意思是它不应该使用新的html文件或iframe。 我花了很多时间搜索,但我想我无法正确搜索。 T_T
答案 0 :(得分:-1)
当然有一种方法可以通过javascript从头开始。像这样的东西;
How to use a link to call JavaScript? 将是一个开始的好地方。
我确实希望插入我的两分钱,这将是一个框架,如bootstrap和/或基础,其中很多这些东西已经设置为你开箱即用。学习如何自己做是很重要的,但这些框架将帮助你在开始坚持这样的事情之前全面了解。
编辑冗余:
来自用户EndangeredMassa:
<html> <head> <script type="text/javascript"> // Wait for the page to load first window.onload = function() { //Get a reference to the link on the page // with an id of "mylink" var a = document.getElementById("mylink"); //Set code to run when the link is clicked // by assigning a function to "onclick" a.onclick = function() { // Your code here... //If you don't want the link to actually // redirect the browser to another page, // "google.com" in our example here, then // return false at the end of this block. // Note that this also prevents event bubbling, // which is probably what we want here, but won't // always be the case. return false; } } </script> </head> <body> <a id="mylink" href="http://www.google.com">linky</a> </body> </html>