我想在我的网站中托管链接。包含onlick
事件并在新选项卡中打开。打开或加载后,需要在加载的页面中添加一些代码。这可能吗?
而且它还需要onclick
在加载页面的所有链接中添加事件。
<a href="url" onclick="somescript()" target="_blank"> sometext here </a>
在我网站的页面上。和 JavaScript
<script>
onload = zawgyi ();
function zawgyi() {var fontfamily='Zawgyi-One';
document.getElementByTagName('body')[0].style.fontFamily=fontfamily;
//and all the way to p,div,span and so on
};
function somescript(){/*code need to inject the all function including javascript
itself and onclick event on all <a> tag.*/
}:
</script>
我知道我可以用书签来做到这一点。但我不想每次都点击。我的目标是通过访问我的网站来阅读 zawgyi 网站,之后用户可以照常使用。
我也想知道实现目标的其他方法。