Jump to content


Photo

if a link within a div is clicked


  • Please log in to reply
1 reply to this topic

#1 yhubu

yhubu
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationToronto, Canada

Posted 06 April 2006 - 04:07 PM

Hi there, I have very very very basic Java Script knowledge and would like to write a script that will open a pop up window if any link within a certain div is clicked.

Does anyone know of a good tutorial or something I can follow?

I have this so far...

<script language="javascript">

var x = document.getElementsByTagName('a');
for (var i=0;i<x.length;i++)
{
if (x[i].getAttribute('type') == 'popup')
{
x[i].onclick = function () {
return pop(this.href)
}
x[i].title += ' (Popup)';
}
}
</script>
Apache 1.3 & MySQL on Windowz 2000 Server

"Everything should be made as simple as possible, but not simpler."

"We can't solve problems by using the same kind of thinking we used when we created them."
"A man's ethical behavior should be based effectually on sympathy, education, and social ties; no religious basis is necessary. Man would indeeded be in a poor way if he had to be restrained by fear of punishment and hope of reward after death." Albert Einstein

#2 yhubu

yhubu
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationToronto, Canada

Posted 11 April 2006 - 08:45 PM

*bump*
Apache 1.3 & MySQL on Windowz 2000 Server

"Everything should be made as simple as possible, but not simpler."

"We can't solve problems by using the same kind of thinking we used when we created them."
"A man's ethical behavior should be based effectually on sympathy, education, and social ties; no religious basis is necessary. Man would indeeded be in a poor way if he had to be restrained by fear of punishment and hope of reward after death." Albert Einstein




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users