#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Heemskerk, The Netherlands
    Posts
    254
    Rep Power
    14

    Question navigation with buttons and javascript


    I've got a question, when I use something like this

    <button onClick='go(window.location.href = "http://somewhere")'>goto</button>

    it does work in Explorer and it gives some error but it works, but when using opera or mozilla it doesn't work at all, I cannot even click the buttons.

    Thanx

    yhcmarc
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Well, a) you're using a non-existent tag, and b) you're using a function that's not really applicable to what you're trying to do. Try this:

    Code:
    <input type="button" value="goto" onclick="window.location.href=http://somewhere" />
    The last time I checked, Opera did not support the button element (pure genius, definitely worth paying for). Alternatively you could do this with an image, a text link, or probably with a submit button. I think the button will not even show up in Netscape if it's not enclosed by form tags.
  4. #3
  5. No Profile Picture
    Beelzebub
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    The nether regions...ok, San Diego
    Posts
    164
    Rep Power
    14
    JMM...just so you know...the <button> tag can be used in the newer browsers (IE5 & NS6)

    So...
    <button onclick="window.location.href='http://somewhere'">goto</button> is valid.

    You can put anything you want between the button tags, including images, or the whole damn page, try it...its fun.
    Last edited by evildj; September 11th, 2001 at 01:58 AM.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    USA
    Posts
    830
    Rep Power
    14
    Ah my bad, my bad. Thanks evil. Sorry marc.

IMN logo majestic logo threadwatch logo seochat tools logo