Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Does onClick exist in DOM

    I want to assign an onClick action to a button, that will alter the state of an onClick command on a banner advert further down the page.
    Managed to change the href of the banner by naming it 'egglink', -
    <a href="#" name="egglink">

    and giving the button the DOM location -document.all.egglink.href="http://www.egg.com";

    But cant figure out if its possible to change the onClick status of the banner using a similar DOM address.

    .....am I being a bit vague??

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    you mean like this?

    document.all.egglink.onclick = function() {
    // some stuff to do ;
    }
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I thought this would do it, but it doesn't seem to eradicate the fault that I am experiencing.
    I've attached a zip containing the test page I'm working on, basically, the button, displays or removes the banner at the bottom of the page. The status is stored in a cookie(adkil) for when the user returns.

    However, if the page is loaded with the banners active, and the banner is then removed via the button, the 'removed' banner jumps the page forward when clicked, as the page space does not have the onClick value of return false;

    If alternately the page loads with the banners disabled and then banners are reactivated via the button, clicking on the egg.com banner does nothing as the space is set to return false;

    As you say, entering - document.all.egglink.onclick - into lines 31 and 32 should allow me to alter the state of onClick, just as I have altered the other page elements in those lines.
    Attached Files Attached Files

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    it seems to be working for me in IE6. which browser are you using?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #5
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm using IE5 - I cant make it run by changing the whole structure, deleting the whole setElements() function, and using 'location.reload();' but it doesnt look as fluid.

  • #6
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry - that should be I 'can' make it run!!!
    (I just 'cant' type properly)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •