navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

javascript people, come to my aid

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> General Web Development >> javascript people, come to my aid
Page: [1]
 
yb2

 

Posts: 653
Joined: 1/30/2006
Status: offline

 
javascript people, come to my aid - 4/3/2006 17:48:42   
my javascript is dodgy to say the least, so can someone tell me why this doesn't work and help me fix it, please?

When the link is clicked I want an alert box to pop up, but it doesn't.

<script language="javascript">
var bc = document.getElementById('newsbutton');

bc.addEventListener('click', function(e){
alert( "hello");
}, true);
</script>
...
<a href="default.aspx" id="newsbutton">blah</a>

Any help gratefully accepted.
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: javascript people, come to my aid - 4/4/2006 11:12:49   
quote:

When the link is clicked I want an alert box to pop up


Without knowing more, you should be able to do something directly like this:

<a href="default.aspx" id="newsbutton" onClick"javascript:alert('Hello!');">blah</a>

That help any?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to yb2)
yb2

 

Posts: 653
Joined: 1/30/2006
Status: offline

 
RE: javascript people, come to my aid - 4/4/2006 13:08:26   
it is, and that's what I've resorted to, but I'm really trying to use the event handling model and put everything in the DOM.

Sounded like a good idea at the time!:)

Most of the stuff on the net about it doesn't give good examples to go with it. I hear js-geeks whine about people not using the DOM model, but they could try helping me along a bit! Damned geeks with their Aspbergers!!:):)

(in reply to rdouglass)
dpf

 

Posts: 7126
Joined: 11/12/2003
From: India-napolis
Status: offline

 
RE: javascript people, come to my aid - 4/4/2006 13:54:56   
quote:

everything in the DOM.
that is the new DOM - there was a prior one...:)

_____________________________

Dan

(in reply to yb2)
yb2

 

Posts: 653
Joined: 1/30/2006
Status: offline

 
RE: javascript people, come to my aid - 4/4/2006 15:48:43   
I saw that there were different versions but I thought the event handling was a current version. Is that right? I've been using FF to test this, has it got the right DOM?

This is why I steer away from js - I always end up in trouble :)

(in reply to dpf)
Page:   [1]

All Forums >> Web Development >> General Web Development >> javascript people, come to my aid
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts