473,748 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem setting InnerText value

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="VBSCR IPT" %>
<html>
<head>
<script language="vbscr ipt">
Sub chgDivText
oDiv1.InnerHtml ="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdiv text">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml ="Div changed by server"
%>
</html>

Thanks for your help.
Jul 22 '05 #1
4 4701
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**********@c harter.net> wrote in message
news:u1******** ********@tk2msf tngp13.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="VBSCR IPT" %>
<html>
<head>
<script language="vbscr ipt">
Sub chgDivText
oDiv1.InnerHtml ="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdiv text">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml ="Div changed by server"
%>
</html>

Thanks for your help.

Jul 22 '05 #2
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.m icrosoft.com> wrote in message
news:em******** ******@TK2MSFTN GP10.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**********@c harter.net> wrote in message
news:u1******** ********@tk2msf tngp13.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="VBSCR IPT" %>
<html>
<head>
<script language="vbscr ipt">
Sub chgDivText
oDiv1.InnerHtml ="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdiv text">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml ="Div changed by server"
%>
</html>

Thanks for your help.


Jul 22 '05 #3
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**********@c harter.net> wrote in message
news:u0******** ******@TK2MSFTN GP15.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.m icrosoft.com> wrote in message
news:em******** ******@TK2MSFTN GP10.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**********@c harter.net> wrote in message
news:u1******** ********@tk2msf tngp13.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="VBSCR IPT" %>
<html>
<head>
<script language="vbscr ipt">
Sub chgDivText
oDiv1.InnerHtml ="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdiv text">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml ="Div changed by server"
%>
</html>

Thanks for your help.



Jul 22 '05 #4
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.m icrosoft.com> wrote in message
news:e3******** ******@TK2MSFTN GP12.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**********@c harter.net> wrote in message
news:u0******** ******@TK2MSFTN GP15.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.m icrosoft.com> wrote in message
news:em******** ******@TK2MSFTN GP10.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**********@c harter.net> wrote in message
news:u1******** ********@tk2msf tngp13.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
throughou t the page.
<%@ language="VBSCR IPT" %>
<html>
<head>
<script language="vbscr ipt">
Sub chgDivText
oDiv1.InnerHtml ="Div changed by button"
End sub
</script>
</head>
<body>
<div id="oDiv1">Div Label</div>
<button onclick="chgdiv text">"Change Div Text"</button>
</body>
<%
oDiv1.InnerHtml ="Div changed by server"
%>
</html>

Thanks for your help.



Jul 22 '05 #5

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

Similar topics

10
1888
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 add more than one to a page. 2. Also need to add the two results to a 'total' field. (See code attached). Many thanks in advance.
4
1418
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 started with javascript so I appologize it this so simple. <script language="javascript"> oFirstName.InnerText = <%=chr(34)&sFirstName&chr(34)%>; oLastName.InnerText = <%=chr(34)&sLastName&chr(34)%>; oMI.InnerText =...
4
2506
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 machines. But on some XP machines, the selection doesn't happen and it defaults to the first element in the options array. Has anybody come across this problem ? Any known workarounds? Thanks Thomas.
2
1551
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> </book>
1
2135
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);
1
1373
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 selected date. I also tried to add a Label server-side control, but I am unable to set its value through Javascript. <form id="mainForm" name="mainForm" action="" method="post"> <p>
3
1483
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 cannot be displayed......". But I won't get any error if I only click the "click me" button one time and then click the browser's "Back" button.
13
2668
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. My probelm.... when I have the user press the update button (which does a post back that loops through the datagrid and updates a database) the field/cell that is filled by the javascript appears to be blank in my update code, even though I can...
2
4552
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 set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
1
3705
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 records = root.ChildNodes;
0
9359
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.