Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #1862

Re: simple javascript question: window.location.href

From Roger Darlington <rogerarm@freeuk.com>
Newsgroups comp.sys.acorn.programmer
Subject Re: simple javascript question: window.location.href
Date 2012-06-30 22:40 +0100
Organization home
Message-ID <b31122a852.rogerarm@rogerarm.freeuk.com> (permalink)
References <0a16f1a752.rogerarm@rogerarm.freeuk.com> <mpro.m6fujm001ll4r0374.vinceh@softrock.co.uk>

Show all headers | View raw


On 30 Jun 2012, Vince M Hudd  wrote:
> Roger Darlington <rogerarm@freeuk.com> wrote:

>> In the Javascript below, which was not written by myself, the url that I
>> want to invoke when someone presses a button is set in
>> windows.location.href whatever that is

>> You will see that I have attempted to call that href using
>> 
>> <a href="javascript:window.location.href">PRESS THIS INSTEAD</a>
>> 
>> Which doesn't seem to work
>> 
>> How do I do this please? [Yes I have googled it, but that seems to confuse
>> me still further :-( ]

> Very, very off-topic for this group. Wasn't there at one point a RISC OS
> 'web developers' mailing list, for which this would be better suited? Does
> it still exist? Would there be any call for one, if not?

> Anyway, you're calling the function incorrectly - but how you want to call
> it depends on what you're ultimately aiming to do. It looks as though it
> needs to be called after the visitor has made some checkbox selections

Yes Vince

>  - in
> which case, there should be a button at the end of the form that the visitor
> can click when he's ready, which might look like:

> 

Ah, I see.
I think it should instead be:
 <input type="button" name="OK" value="OK" 
onClick="javascript:checkbox_test();">

And it now works! Many thanks Vince.



> That creates a button called "OK" and with the text "OK" displayed. When it
> is clicked, the onClick="" calls the JavaScript function within the quotes.
> That function sets window.location.href - and I think that actually sets the
> address of the page being viewed, so would cause the specified page/address
> to be loaded, replacing the one with the form (checkboxes and button).

> (All IIRC, long time since I looked at JavaScript, untested in the best
> tradition of usenet, E&OE, etc).



-- 

Cheers
Roger
Today is yesterdays tomorrow and it's already gone

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

simple javascript question: window.location.href Roger Darlington <rogerarm@freeuk.com> - 2012-06-30 13:45 +0100
  Re: simple javascript question: window.location.href Vince M Hudd <vinceh@softrock.co.uk> - 2012-06-30 17:16 +0100
    Re: simple javascript question: window.location.href Roger Darlington <rogerarm@freeuk.com> - 2012-06-30 22:40 +0100
      Re: simple javascript question: window.location.href Alan Adams <alan@adamshome.org.uk> - 2012-07-01 22:42 +0100

csiph-web