I hope this illustrates my question a little better. Consider the following
script; why does the client side script change the div object's innerHtml
property but the server side script does not? Debug reports that the server
script does not see the document's div object but I thought I read that
varibles created with page scope are available throughout the page.
<%@ language="VBSCRIPT" %>
<html>
<head>
<script language="vbscript">
Sub chgDivText
oDiv1.InnerHtml="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdivtext">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml="Div changed by server"
%>
</html>
Thanks for your help. 4 4688
What you read was correct, but what you're missing is that the script there
runs at two different times. The server-side script runs before the page is
ever delivered to the browser, so doesn't have access to client-side data.
An ASP variable is accessible throughout the page, but any client-side
objects or variables (such as DOM references) are most definitely not
available.
--
Jason Brown
Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
"scott cooper" <sc**********@charter.net> wrote in message
news:u1****************@tk2msftngp13.phx.gbl... I hope this illustrates my question a little better. Consider the following script; why does the client side script change the div object's innerHtml property but the server side script does not? Debug reports that the server script does not see the document's div object but I thought I read that varibles created with page scope are available throughout the page.
<%@ language="VBSCRIPT" %> <html> <head> <script language="vbscript"> Sub chgDivText oDiv1.InnerHtml="Div changed by button" End sub </script> </head> <body> <div id="oDiv1">Div Label</div> <button onclick="chgdivtext">"Change Div Text"</button> </body> <% oDiv1.InnerHtml="Div changed by server" %> </html>
Thanks for your help.
Thanks, I kind of thought that was the case but I dont understand why an
object I created in the server script could not be used by a client side
script and returned the object required error when I tried read one of the
object's properties.
"Jason Brown [MSFT]" <i-******@online.microsoft.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl... What you read was correct, but what you're missing is that the script there runs at two different times. The server-side script runs before the page is ever delivered to the browser, so doesn't have access to client-side data. An ASP variable is accessible throughout the page, but any client-side objects or variables (such as DOM references) are most definitely not available. -- Jason Brown Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
"scott cooper" <sc**********@charter.net> wrote in message news:u1****************@tk2msftngp13.phx.gbl...I hope this illustrates my question a little better. Consider the following script; why does the client side script change the div object's innerHtml property but the server side script does not? Debug reports that the server script does not see the document's div object but I thought I read that varibles created with page scope are available throughout the page.
<%@ language="VBSCRIPT" %> <html> <head> <script language="vbscript"> Sub chgDivText oDiv1.InnerHtml="Div changed by button" End sub </script> </head> <body> <div id="oDiv1">Div Label</div> <button onclick="chgdivtext">"Change Div Text"</button> </body> <% oDiv1.InnerHtml="Div changed by server" %> </html>
Thanks for your help.
in ASP, client and server are two separate environments and should be
treated as such. ASP.NET tries to blur the boundary somewhat, with
server-side objects and events which can either smotth things or complicate
things depending on your level of understanding.
--
Jason Brown
Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no
rights.
"scott cooper" <sc**********@charter.net> wrote in message
news:u0**************@TK2MSFTNGP15.phx.gbl... Thanks, I kind of thought that was the case but I dont understand why an object I created in the server script could not be used by a client side script and returned the object required error when I tried read one of the object's properties.
"Jason Brown [MSFT]" <i-******@online.microsoft.com> wrote in message news:em**************@TK2MSFTNGP10.phx.gbl... What you read was correct, but what you're missing is that the script there runs at two different times. The server-side script runs before the page is ever delivered to the browser, so doesn't have access to client-side data. An ASP variable is accessible throughout the page, but any client-side objects or variables (such as DOM references) are most definitely not available. -- Jason Brown Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
"scott cooper" <sc**********@charter.net> wrote in message news:u1****************@tk2msftngp13.phx.gbl...I hope this illustrates my question a little better. Consider the following script; why does the client side script change the div object's innerHtml property but the server side script does not? Debug reports that the server script does not see the document's div object but I thought I read that varibles created with page scope are available throughout the page.
<%@ language="VBSCRIPT" %> <html> <head> <script language="vbscript"> Sub chgDivText oDiv1.InnerHtml="Div changed by button" End sub </script> </head> <body> <div id="oDiv1">Div Label</div> <button onclick="chgdivtext">"Change Div Text"</button> </body> <% oDiv1.InnerHtml="Div changed by server" %> </html>
Thanks for your help.
Thank you Jason. It seemed to me that I should be able to referance
variables and objects created by a server script but your words make sense
to me. I guess it might have been wishful coding. :-)
"Jason Brown [MSFT]" <i-******@online.microsoft.com> wrote in message
news:e3**************@TK2MSFTNGP12.phx.gbl... in ASP, client and server are two separate environments and should be treated as such. ASP.NET tries to blur the boundary somewhat, with server-side objects and events which can either smotth things or complicate things depending on your level of understanding.
-- Jason Brown Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
"scott cooper" <sc**********@charter.net> wrote in message news:u0**************@TK2MSFTNGP15.phx.gbl... Thanks, I kind of thought that was the case but I dont understand why an object I created in the server script could not be used by a client side script and returned the object required error when I tried read one of the object's properties.
"Jason Brown [MSFT]" <i-******@online.microsoft.com> wrote in message news:em**************@TK2MSFTNGP10.phx.gbl... What you read was correct, but what you're missing is that the script there runs at two different times. The server-side script runs before the page is ever delivered to the browser, so doesn't have access to client-side data. An ASP variable is accessible throughout the page, but any client-side objects or variables (such as DOM references) are most definitely not available. -- Jason Brown Microsoft GTSC, IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
"scott cooper" <sc**********@charter.net> wrote in message news:u1****************@tk2msftngp13.phx.gbl... I hope this illustrates my question a little better. Consider the following script; why does the client side script change the div object's innerHtml property but the server side script does not? Debug reports that the server script does not see the document's div object but I thought I read that varibles created with page scope are available throughout the page.
<%@ language="VBSCRIPT" %> <html> <head> <script language="vbscript"> Sub chgDivText oDiv1.InnerHtml="Div changed by button" End sub </script> </head> <body> <div id="oDiv1">Div Label</div> <button onclick="chgdivtext">"Change Div Text"</button> </body> <% oDiv1.InnerHtml="Div changed by server" %> </html>
Thanks for your help.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ed |
last post by:
Hoping someone an assist me urgently. I would truly appreciate and help.
I have a form and prices are based on 'price break'.
1.The price break fields work fine, but I cannot for the life of me...
|
by: scott cooper |
last post by:
Can someone help me understand why this script sets only some of the
div.InnerText proerties of my page. If I set the language to VBScript and
remove the semicolons it works. I'm just getting...
|
by: thomastk |
last post by:
Hi,
In the following script, I am trying to set selection to a select
option element, that is newly created within the script. It works fine
on IE installations on Windows 2000 and some XP...
|
by: Paul Duncan |
last post by:
Hi.
The question is: How do I set the value of PageElement to the innertext
'Hello World' in my xml when I use XMLSerializer?
My source xml is:
<book>
<page number="1">Hello World</page>...
|
by: Robert Storrs |
last post by:
I need to set the value of a asp text box in javascript.
<asp:TextBox id="txtUserValue" runat="server"
>test</asp:TextBox>
I have tied:
function setValue(valueData) {
alert(valueData);
|
by: Mike |
last post by:
Hi,
I am developing a JavaScript calendar control. I want my user control to
expose a property that returns the value of the selected calendar date. I
have an "input" control that displays the...
|
by: Quentin Huo |
last post by:
Hi:
When I tried the following code, I got an error:
if I clicked "Click me" button more than one time, and than click "back"
button in the IE browser Toolbar, I will get an error: "The page...
|
by: Lyners |
last post by:
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value....
|
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was...
|
by: Martin Pöpping |
last post by:
Hello,
I´ve a problem with parsing a double value from an xml file.
My code looks like this:
int concept_id;
double rank;
XmlElement root = documentXMLString.DocumentElement;
XmlNodeList...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |