You may add these tow lines before set the attr: var url=document.URL; var title=document.title;
besides,URL and title is not properties of the window object,you cannot refer to them directly. 2009/9/17 amuhlou <amysch...@gmail.com> > > where are the title and url variables coming from? > > > On Sep 16, 9:05 pm, Jacques <j...@whistlerwebandprint.com> wrote: > > Hi everyone I am trying to append the full page url and contents of > > the title tag to some social bookmarking links I have the code below > > but it does not seem to be working can anyone see what I am doing > > wrong or point me in the right direction? > > > > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head> > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > > <title>test social</title> > > <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/ > > jquery.min.js" type="text/javascript"></script> > > </head> > > <body> > > <div class="share"> > > <ul> > > <li class="delicious"><a href="#" id="shareit-delicious" > > target="_blank">share with delicious</a></li> > > <li class="stumbleupon"><a href="#" id="shareit-stumbleupon" > > target="_blank">share with stumbleupon</a></li> > > </ul> > > </div> > > <script type="text/javascript"> > > $(document).ready(function(){ > > $('#shareit-delicious').attr('href', ' > http://del.icio.us/post? > > v=4&noui&jump=close&url=' + url + '&title=' + title); > > $('#shareit-stumbleupon').attr('href', ' > http://www.stumbleupon.com/ > > submit?url=' + url + '&title=' + title); > > }); > > </script> > > </body> > > </html> >