I want to write a JQuery script that it inserts an image before a DIV.
But can't figure out a way to write it so that the domain of the URL
isnt hard coded.
see below:
Code:
$(document).ready(function(){
$('<a href="http://anothersite.com">
<img src="http://mysite.com/images/transparent.gif" />
</a>').insertBefore('div.player');
};
});
That works fine. But if the domain moves it will break.
I wonder if there is some kind of jQuery placeholder for the
current domain?
Maybe use something like this?
Quote:
|
var pathname = window.location.pathname;
|
and explode it using slashes?
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals" Please login or register to view this content. Registration is FREE
Last edited by TWD; 06-23-2011 at 02:24 AM..
|