hello
I wrote code for a scramble word game and I am trying to set focus everytimge I click on check button..I've got it so it will set focus when I start game, but whenever I put put setFocus() on the onclick of the button it will not work...
is there any way the I can have two procedures for onclick...like

<input id="inbox" type="text" /><input type="button" value="check" onclick="guess()" "setFocus()"/>

I also want to selectall if the word is incorrect

not sure how to go about doing this..I did research on this problem, but they all give me examples on applying just one thing to the onclick not two..
thank you

Msqueen,

Javscript written in an HTML onclick/onchange/onblur etc. is nothing more than the contents of an anonymous function. Therefore, simply separate statements with semicolons.

<... onclick="guess(); setFocus();" ...>

Airshow

That fixed my problem of focus,,but the select all didn't work...here is how I coded a funtion for select all and I also put it in the onclick of the button as
selectAll();

function selectAll()
		{
			document.getElementById("inbox").selectAll();
			}// set select all to the text box

Answered my own question..thank you for your help

It was that I put selectAll in my function instead of select..

function selectAll()
        {
            document.getElementById("inbox").select();
            }// set select all to the text box
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.