SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "<< Back" Button

    Is it possible to assign a button to go back to the previous page, bearing in mind the link for this is this...

    &nbsp;javascript:history.back(1)

    Also, the button is already in a form and so a new form inside a form will not work.
    I have tried...

    <input type="button" action="...">

    ...but that doesnt work. Also...

    <input type="button" href="...">

    ...doesn't work.

    Any ideas?

    - Will

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="button" onClick="javascript:history.go(-1);">

  3. #3
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers!

  4. #4
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    history.go(-1);
    history.back();

    or in asp

    response.redirect server.variables("http_referrer")
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  5. #5
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need javascript:, because onClick is already a javascript event. You only need to javascript: when you want to execute js code in a href.

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know, but I like to use it for good measure, so I am totally sure of what's going on.

  7. #7
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You are totally sure what's going on...

    The href="javascript:" this is newer and onClick="doShyte();" is much older and widely accepted.

    Using javascript: is where you might run into problems (highly doubtful though).
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  8. #8
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What kind of problems? I've used it on NS, IE and Opera without fail I believe. Whether it's newer or not doesn't really concern me, neither does which is more widely used. If it works, and I find that it makes it more clear to me what's going on, I'll use it.

    Picture a rather large HTML document. Rather than search for a specific function name, a search for "javascript:" would yield the function calls within. I'm sure there are other similar advantages, but that's the only one I can think of off the top of my head.

  9. #9
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    How could it cause problems?

    1. It's non-standard
    2. It's crap implementation
    3. it's "javascript:" not "java script:"
    4. Just cause you haven't run into problems in the PAST with bad coding habits (which is what this is, we all have them) doesn't mean you won't in the future

    "whether it's newer or not, whether it's more widely used, doesn't matter so long as I'm happy"... Part of being a professional is being responsible. Bad coding habits aren't being responsible. I'm not ragging on you, but there isn't any defence or offence here, it's just bad coding habits, no biggie mate.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  10. #10
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1 - The colored CSS scrollbar on your site is non-standard. A lot of things are non-standard, but they have value anyway.

    2 - "crap implementation"? I don't see this as anymore than you saying "I don't like it."

    3 - I did not put that space there. As you'll notice, it broke your word up into two words "java" and "script" -- this is a problem with vBulletin, or something of the like. I never break it up into two words.

    4 - This is another opinion. The only evidence that's been provided to support the opinion that it is a bad coding habit is that it's not standard, which I don't think matters enough to ditch it, considering it clearly spells things out, AND, as I mentioned, has some search value.

    Hey, I realize what you're saying, and you're entitled to believe what you want, but I'm not just going to take your word for it. I am a big believer in proper coding -- people who don't indent annoying the living crap out of me, but I don't know if this qualifies as a poor habit.

  11. #11
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Point taken, let's agree to disagree then
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  12. #12
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fair enough

  13. #13
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's nothing nonstandard about putting javascript: into the href, and it's been around just as long as onClick. I also don't think it means you're irresponsible.

    Also, the javascript separation is a security thing for vBulletin, so that you don't try to execute any js code from your posts.

  14. #14
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Nobody said anything about href="javascript:" being nonstandard (though technically it is).

    The onClick="javascript:" is simply because it's a bad coding habit. What defines bad coding habits? Anything that is sloppy, useless or would make the creator go

    Anyways, the argument is over.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright


Bookmarks

Posting Permissions

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