Is all script run client-side and othe simple questions.

A

active

Because I received much help from this NG I have this in the .master.vb
file:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Image1.Attributes.Add("onload", "resizeImg('" + Image1.ClientID + "')")

End Sub



and define the Script for resizeImg in the .Master file.

This because I want resizeImg to run on the client side.



To convince myself it is running on the client side I put an error into the
script so the IE loading would break if it runs the script while loading. It
does. I believe that means it is indeed running client side. Be nicer if I
could do a QuickWatch at the break that would prove it was running client
side.

0) Know what I could watch that changes at client side?



My other questions are:

1) Does all script run client side.

2) If not, how is it controlled.

3) Are Attributes.Add statements only put into the Me.Load event

4) Me refers to what - the Document, the Page, ...



thanks

It was also suggested in this NG that I look into RegisterStartupScript as
an alternate way of running script client side, which I plan to look into
now.
 
B

bruce barker

client javascript only runs in the browser. you can place script inline
,so its executed during the html parse phase of the browser or tie to an
event.

<html>
<body onload="alert('html has been parsed')">
<script>document.write("<b>hello</b>");</script>
</body>
</html>

adding script calls to a control can be done anytime before render.

me refers the class instance the method belongs to. so if its code in
the page class then its the page instance.

-- bruce (sqlwork.com)
 
A

active

Is there any other kind of javascript then "client javascript"?
Basically, does all javascript run clientside?

Does "render' occur after the entire HTML is read.
Can I think of it this way:

The server created the HTML but does not , for example, load images.

The client ( means the same as "the browser") parses the HTML without
displaying anything except an empty screen (I think I've observed that and
error in my script occurs with a solid Body color screen). Scripts can run
here and errors occur in them. Are there any events that fire during
parsing?


Then while rendering, events like Load occur and related scripts run then.




Thanks
 
G

Guest

Because I received much help from this NG I have this in the .master.vb
file:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Image1.Attributes.Add("onload", "resizeImg('" + Image1.ClientID + "')")

End Sub

and define the Script for resizeImg in the .Master file.

This because I want resizeImg to run on the client side.

To convince myself it is running on the client side I put an error into the
script so the IE loading would break if it runs the script while loading. It
does. I believe that means it is indeed running client side. Be nicer if I
could do a QuickWatch at the break that would prove it was running client
side.

0) Know what I could watch that changes at client side?

My other questions are:

1) Does all script run client side.

2) If not, how is it controlled.

3) Are Attributes.Add statements only put into the Me.Load event

4) Me refers to what - the Document, the Page, ...

thanks

It was also suggested in this NG that I look into RegisterStartupScript as
an alternate way of running script client side, which I plan to look into
now.

http://www.beansoftware.com/ASP.NET-Tutorials/Client-Script-Debugging.aspx
 
A

active

I can't find any reference at all to answers to my questions in that site
(which I like a lot)
 
G

Guest

I can't find any reference at all to answers to my questions in that site
(which I like a lot)

The link I sent you is to describe the way to debug a client side
script in VS.NET. That is the answer of your question #0.

Client-side scripts, such as javascript or vbscripts are client-side.
Using the Attributes.Add method you tell to add a custom attribute to
the client, to be precise, you added an event handler for the onload
client-side event. As I said, Attributes.Add method is designed for
custom attributes and can be used for any of them: for example,
Attributes.Add("onclick", "alert('hello);"), Attributes.Add("style",
"color:red"), etc...
 
A

active

Thanks a lot.

What I meant to ask in 0) was is there some variable (or method I could
call) that has a different value at server side then client side. By
"watch" I meant IDE's QuickWatch" but I wasn't very clear. In any event, I
did like that site. It's where I got the debugger statement I inserted into
my script. Even tho I have not got that to work yet.

Thanks again.

Anon User said:
The link I sent you is to describe the way to debug a client side
script in VS.NET. That is the answer of your question #0.

Client-side scripts, such as javascript or vbscripts are client-side.

Are there any other kinds is what I confused about. Are all scripts client
side?
 
G

Guest

Thanks a lot.

What I meant to ask in 0) was is there some variable (or method I could
call) that has a different value at server side then client side.

Client-side variable or method is on the client, and cannot have any
"server-side" value, it executes independently.
By
"watch" I meant IDE's QuickWatch" but I wasn't very clear. In any event, I
did like that site. It's where I got the debugger statement I inserted into
my script. Even tho I have not got that to work yet.

Where did you place the debugger statement? Add your code here...
 
A

active

Here is some code. Stops when the resizeImg is running at "debugger "

hover over it produces:

debugger undefined

Also tried

<script language="JavaScript" type="text/JavaScript">

Thanks again



<head id="Head1" runat="server">

<title></title>


<script type="text/javascript">



function resizeImg(oID)

{


debugger;

var o = document.getElementById(oID);

var p=o.parentElement;
 
A

active

Where did you place the debugger statement? Add your code here...
no problem
I guess it stopped because it was suppose to.

I don't know what the "undefined" means
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top