我在page0.html中有两个标签。我想在page1.html中显示哪个标签被点击了:
<a href="page1.html" target="_blank">A</a>
<a href="page1.html" target="_blank">B</a>
我想将page1.html看起来像:
按下链接A
或
链接B被按下了。
可以使用Javascript吗?或者我应该使用其他东西吗?
非常感谢
答案 0 :(得分:3)
您可以添加哈希到url(href)并通过foreach (var course in customerInDb.CoursesEnrolled)
{
_context.Entry(course).State = System.Data.Entity.EntityState.Unchanged;
}
page0.html
window.location.hash
page1.html
<a href="page1.html#A" target="_blank">A</a>
<a href="page1.html#B" target="_blank">B</a>
答案 1 :(得分:0)
您还可以在page0.html
中使用?
<a href="page1.html?a" target="_blank">A</a>
<a href="page1.html?b" target="_blank">B</a>
在page1.html
中 var parts = window.location.search.substr(1);
alert('Link '+parts+' was pressed');
答案 2 :(得分:0)
以上答案可能是另一种选择。我宁愿建议使用document.referrer来识别它。 有关更多详细信息,请参阅堆栈溢出查询: How do you get the previous url in Javascript?
答案 3 :(得分:0)
您可以通过onclick事件
进行内联Select model, price, rating, state, brands.brandname, brands.website,
bikebrandsellstock.size, bikebrandsellstock.brandstock, bikeshopsellbike.bikeshopname, bikeshopsellbike.size, bikeshopsellbike.bikeshopstock
from bikes
INNER JOIN brands ON bikes.model = brands.model
INNER JOIN bikebrandsellstock ON bikes.model = bikebrandsellstock.model
INNER JOIN bikeshopsellbike ON bikes.model = bikeshopsellbike.model
WHERE SUM(bikebrandsellstock.stock+bikeshopsellbike.stock)
IN (SELECT MAX(SUM(bikebrandsellstock.stock+bikeshopsellbike.stock)))