Showing posts with label somewhat. Show all posts
Showing posts with label somewhat. Show all posts

Thursday, March 29, 2012

HTML Image Control (and VB vs JavaScript)

I'm a VB programmer, somewhat new to VB.Net, and completely new to (and clueless with) ASP.Net

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.

Thursday, March 22, 2012

HTML Code embedded within HTML Page as Text

I know this is a somewhat rudimentary question but...

I want to display HTML code on an HTML page but I want the code to display
as text. In other words, I want the code not to be rendered as HTML on the
HTML page, but rather have it rendered as simple text.

This must be easy to do as I see it everywhere.

TIA."Paul" <Paul@.discussions.microsoft.comwrote in message
news:D092F17D-1B17-4C1C-BCD0-F60B7A640368@.microsoft.com...

Quote:

Originally Posted by

I want to display HTML code on an HTML page but I want the code to display
as text. In other words, I want the code not to be rendered as HTML on the
HTML page, but rather have it rendered as simple text.
>
This must be easy to do as I see it everywhere.


<pre>

</pre>

--
Mark Rae
ASP.NET MVP
http://www.markrae.net
I initially tried this (before the post) and it did not work.

For example the code below showed up as a hyperlink...

<pre>
<a href="http://links.10026.com/?link=help">asas</a>
</pre>

"Mark Rae [MVP]" wrote:

Quote:

Originally Posted by

"Paul" <Paul@.discussions.microsoft.comwrote in message
news:D092F17D-1B17-4C1C-BCD0-F60B7A640368@.microsoft.com...
>

Quote:

Originally Posted by

I want to display HTML code on an HTML page but I want the code to display
as text. In other words, I want the code not to be rendered as HTML on the
HTML page, but rather have it rendered as simple text.

This must be easy to do as I see it everywhere.


>
<pre>
>
</pre>
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
>
>


"Paul" <Paul@.discussions.microsoft.comwrote in message
news:1FA6E284-FA15-4C39-9616-47785A5F4046@.microsoft.com...

Quote:

Originally Posted by

>I initially tried this (before the post) and it did not work.


Works for me...

You can see an example of it here:
http://www.htmlcodetutorial.com/linepar/_PRE.html
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
This does NOT work
<PRE>
<a href="http://links.10026.com/?link=www.blah.com"Click here to got to blah.com</a>
</PRE>

However This Works
<PRE>
<a href="http://links.10026.com/?link=www.blah.com"> Click here to got to blah.com</a>
</PRE>

"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:eM80IiVIIHA.3940@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

"Paul" <Paul@.discussions.microsoft.comwrote in message
news:1FA6E284-FA15-4C39-9616-47785A5F4046@.microsoft.com...
>

Quote:

Originally Posted by

>>I initially tried this (before the post) and it did not work.


>
Works for me...
>
You can see an example of it here:
http://www.htmlcodetutorial.com/linepar/_PRE.html
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


"IfThenElse" <sql_agentman@.hotmail.comwrote in message
news:erYYK%23VIIHA.588@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:eM80IiVIIHA.3940@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>"Paul" <Paul@.discussions.microsoft.comwrote in message
>news:1FA6E284-FA15-4C39-9616-47785A5F4046@.microsoft.com...
>>

Quote:

Originally Posted by

>>>I initially tried this (before the post) and it did not work.


>>
>Works for me...
>>
>You can see an example of it here:
>http://www.htmlcodetutorial.com/linepar/_PRE.html


Quote:

Originally Posted by

This does NOT work
<PRE>
<a href="http://links.10026.com/?link=www.blah.com"Click here to got to blah.com</a>
</PRE>
>
However This Works
<PRE>
<a href="http://links.10026.com/?link=www.blah.com"> Click here to got to blah.com</a>
</PRE>
>


Yes - I forgot to mention the encoding part - apologies, group...

--
Mark Rae
ASP.NET MVP
http://www.markrae.net