472,374 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

Using C# script instead of JavaScript problems

A couple of questions I am having problems with converting my JavaScript to
C#.

I have the following code using JavaScript for the mouseover handler that
works fine:
<SCRIPT language=JavaScript>
function MyMouseOver()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com"
ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo
Nov 18 '05 #1
2 4007
1. The onMouseOver and onMouseOut events are client only functions. You
can't implement those using javascript (well, you could, but it would be a
waste of time and resources. You'd have to implement still more javascript
to do the postback on the mouse over event, which would be quite useless).

2. You cannot call server side functions from a client side script unless
you're posting back the form, which again, is fruitless if you're trying to
manipulate something on the client end. Stick with Javascript.

ASP.NET (including C#, or any other .NET language) is a server side
programming language. You cannot manipulate client side properties using
them, because server side code only gets executed once during a page's life
cycle (the actual request from the server).

Hope this helps...

I was minding my own business when Jeronimo Bertran blurted out:
A couple of questions I am having problems with converting my JavaScript to C#.

I have the following code using JavaScript for the mouseover handler that
works fine:
<SCRIPT language=JavaScript>
function MyMouseOver()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com"
ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo


--
Insert corny line here
Nov 18 '05 #2
I was minding my own business when -=Chris=- blurted out:
1. The onMouseOver and onMouseOut events are client only functions. You
can't implement those using javascript
[Correction: You can't implement those using C#]

(well, you could, but it would be a waste of time and resources. You'd have to implement still more javascript to do the postback on the mouse over event, which would be quite useless).

2. You cannot call server side functions from a client side script unless
you're posting back the form, which again, is fruitless if you're trying to manipulate something on the client end. Stick with Javascript.

ASP.NET (including C#, or any other .NET language) is a server side
programming language. You cannot manipulate client side properties using
them, because server side code only gets executed once during a page's life cycle (the actual request from the server).

Hope this helps...

I was minding my own business when Jeronimo Bertran blurted out:
A couple of questions I am having problems with converting my JavaScript to C#.

I have the following code using JavaScript for the mouseover handler that
works fine:
<SCRIPT language=JavaScript>
function MyMouseOver()
{
alert("We are there!");
}
</SCRIPT>

<H3>Walk over <A onmouseover=MyMouseOver() ref="http://msdn.microsoft.com" ME!</A></H3>

1- How can I change the script to C# using <script language=C#
runat="server">

Changing the script in the following manner doesn't work:

<SCRIPT language=C# runat="server">
void MyMouseOver()
{
// Do something
}
</SCRIPT>

2- Can I call server side functions from within JavaScript functions?

Thanks !!!

Jeronimo


--
Insert corny line here
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Maria Bitsku | last post by:
How do I deactivate a window using Javascript. For example if I have a window that opens up another window, how do I prevent the user from clicking (doing anything) in the original window until...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
13
by: nobody | last post by:
Hello all, I've searched just about everything and although I can see that other people are having problems, but theirs don't seem to relate, so in a last ditch attempt, my posting! Script...
6
by: abdullah1983 | last post by:
Hi Guys, I need some clarification regarding the problem with safari browser. Please find my code below. I'm setting the image src, mouseover and mouseout using javascript. The mouseover and...
21
by: hemant.singh | last post by:
Hello all, I am try'g to send window.location.href to the server script who will generate dynamic javascript according to the referral name comg in as param Now bcz <script language="javascript"...
8
by: otto | last post by:
Hi, all: I have a problem with the inclusion of .js files in mu .aspx pages when using Master Pages. I try to explain it. If I make a web project without master pages I simply put in the head...
9
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.