You are here: Re: CSS & Div Tag, Hyperlinked? « HTML « IT news, forums, messages
Re: CSS & Div Tag, Hyperlinked?

Posted by Yogi_Bear_79 on 10/09/06 23:06

"Ben C" <spamspam@spam.eggs> wrote in message
news:slrneicuds.503.spamspam@bowser.marioworld...
> On 2006-10-06, Yogi_Bear_79 <nospam@spamsux.com> wrote:
>>
>> "Ben C" <spamspam@spam.eggs> wrote in message
>> news:slrneic6b7.elb.spamspam@bowser.marioworld...
>>> On 2006-10-06, Yogi_Bear_79 <nospam@spamsux.com> wrote:
>>>>
>>>> "Harlan Messinger" <hmessinger.removethis@comcast.net> wrote in message
>>>> news:4olbu8Ff1nu8U1@individual.net...
>>>>> Ben C wrote:
>>>>>> On 2006-10-05, Yogi_Bear_79 <nospam@spamsux.com> wrote:
>>>>>>> I created a floating window with the code below. I call it with
>>>>>>> <div
>>>>>>> id="Uleft"></div>. It contains a table with text and one image. I
>>>>>>> would
>>>>>>> like to make the entire container clickable. When I click on it I
>>>>>>> want
>>>>>>> the parent page to change to another page on my website. How?
>>>>>>
>>>>>> Put the whole lot inside an <a> element.
>>>>>
>>>>> A DIV element can't go inside an A element. Only inline elements
>>>>> (excluding another A) can go inside an A.
>>>>
>>>> So is it not possible to do what I want?
>>>
>>> You can use JavaScript:
>>>
>>> <script>
>>> function click()
>>> {
>>> location = "http://www.google.co.uk";
>>> }
>>>
>>> function main()
>>> {
>>> var e = document.getElementById("Uleft");
>>> e.addEventListener("click", click, false);
>>> }
>>>
>>> onload = main;
>>> </script>
>>>
>>> In your document somewhere should do the trick.
>>
>> Thanks! I guess I still need a little more help though. I tried the code
>> in
>> the BODY tag, the DIV tag, and even as a SSI, but nothing happens. any
>> ideas?
>
> I tried it and it did work for me. Are you using Firefox? If so you get
> a "JavaScript Console" (Tools menu) that tells you the errors. Otherwise
> you can put alerts in there to check which bits are being executed etc.
>
> Putting the <script> in the head element might be the best place, to be
> sure it's run before the document.onload event happens (which it's then
> going to listen for). But I think anywhere _should_ be fine.


Currently I have it as an SSI. IE is claiming Line 12 Char 5 is the
problem, Below is the .js file I have it saved as. I call the SSI inside
the <head> tag like this <SCRIPT language=JavaScript1.2
src="includes/ULeft.js"></SCRIPT>. I have other SSI's called in similar
fashion that work. So I don't think it is my test server. I would prefer to
run it as an SSI. Thanks for your time

// JavaScript Document

function click()
{
location = "http://www.google.co.uk";
}

function main()
{
var e = document.getElementById("ULeft");
e.addEventListener("click", click, false);
}

onload = main;

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация