I'm trying to build a simple game as a programming exercise. I have HTML Image Controls in place, but when I look at the code behind, there doesnt seem to be an OnClick event. How can I add one ?
Also, it seems possible to add a client side OnClick event from HTML View. But everytime I try it, Visual Studio wants JavaScript. This seems pointless to me, at best I can fumble my way through JavaScript, but as a VB programmer, what i WANT to do is write this in VB. There has to be a way to change the language to VB, right ?
BTW, I notice in some language drop downs (that I dont yet know how to use) there is "vb" and "visualbasic". What's that all about ?
Thanks, (a very frustrated) AARRGGHHH> I have HTML Image Controls in place, but when I look at the code behind, there doesnt seem to be an OnClick event. How can I add one ?
Change your HTML Image controls intoImage Buttons, which do indeed expose an onClick event.
> There has to be a way to change the (Javascript) language to VB, right ?
Wrong. Javascript works with the HTML's document model. It is client-side script. For example, using Javascript you can bounce an image of a ball around the screen. Such client-side operations are meaningless to a server-side language such as VB.NET.
For example, if you're making an internet game, you'd really want use as much Javascript as possible. If every "gamer action" causes the page to return to the server, it will be a slow game indeed.
> BTW, I notice in some language drop downs (that I dont yet know how to use) there is "vb" and "visualbasic". What's that all about ?
No idea. There's a few "flavours" of Visual Basic ... so, the dropdown options could mean anything.
As you're new to ASP.NET, you might like to work through theQuickStart Tutorials, as they have been specifically designed to teach you the fundamentals.
I hope this helps.
> Change your HTML Image controls into Image Buttons, which do indeed expose an onClick event.
Thanks for the suggestion, that seems to be working out well.
>> There has to be a way to change the (Javascript) language to VB, right ?
>Wrong. Javascript works with the HTML's document model. It is client-side script.
In that case, I'm guessing I can probably at least use VBScript for client side issues, correct ? Do I just change the language attribute to "VBScript" ?
> For example, if you're making an internet game, you'd really want use as much Javascript as possible. If every "gamer action" causes the page to return to the server, it will be a slow game indeed.
It's not an action game, just a simple question and answer game, so server side should work out fine.
Thanks again for your help
> I'm guessing I can probably at least use VBScript for client side issues, correct?
You could, but you shouldn't. Read:Good or Evil? VBScript on the client side.
Javascript is the way to go. In your case, with a question and answer game, there's probably little if any client-side scripting necessary.
Understanding Javascript is anextremely valuable skill for anyone creating websites or web applications.
I hope this helps.
No comments:
Post a Comment