I am using the code below for loading an external page into a lightbox. How could I pass from the href tag, a variable named 'page' to the javascript (line 1) containing the value of a page link = 'country.php'. I am wanting to use this script call several times without having to have additional javascript lines for each link.<a href> link with id
<script>
$("a#selector").live("click", function(){$(".overlayInner").load("/country.php"); })
$("a#selector").live("click", function(){$(".overlayOuter").fadeIn(300); })
$("a#selector").live("click", function(){$(".overlayInner").fadeIn(500); })
$("a#selector").live("click", function(){$(".closepop").fadeIn(500); })
</script>
<a id="selector" href="#"><img src="/images/somegraphic.gif"></a>
Any help is much appreciated.
あなたは 'href'属性を取得する方法を知りたいですか? –
あなたは 'function myFunc(url)'のようなパラメータを持つ関数の中にjsコードを置くだけで、 '.load'の内部でそのURLを' .load(url) 'として使用し、必要なパラメータ。本当に基本的なものですが、より具体的にする必要があります。 –
いいえ、私はjavscriptに追加の変数を渡したいと思います。例: – Rodney