A more informative example:
4:undefined2: undefined3:local1global
Is produced by the following code:
-------------------------------------------------------
<%@ language="javascript"%>
<script language="javascript" runat="server">
var global = 'global';
Response.Write('1' + global)...
You can, yes - so long as you don't call server specific object (i.e. Response) on the client-side, or client-specific objects (i.e. document) on the server, there's no reason you can't use the same code, because it's the same language.
So you might define a general object that you include in...
I'm trying to do this because I want to declare classes in a .js file that I can then include on both the Server and Client sides. Thus, I can write HTML on the server side (readable by search engines), and update that HTML client-side, using the same class definition.
Is there a way I can do...
Hi Chopstik, I'm not sure that's valid - why would a string suddenly require use of a value property to access it's value?
I tested your suggestion to be sure, but no luck!
Thanks anyway. Any other thoughts?
Hi, throw the following example into a text file, save with an ASP extension, and execute it in IIS6/7. Can anyone explain why Test 1 works fine, and Test 2 returns undefined? Is it something to do with variable scope?
Thanks,
Iain
<%@ language="javascript"%>
<script type="text/javascript"...
I'm developing an eCommerce application. A page's content is written to the page from the server, to ensure the search engines see it.
On the client-side, I add event handlers to various elements on the page. Some of these event handlers should only be present if the user is logged in - i.e...
Lee, thanks for your response. I'm concerned I didn't make myself clear, so let me expand.
Assume a test.js file with function Product () {} in it.
You can include this script in an ASP page as follows:
<%@ language="javascript"%>
<script language="Javascript" src="test.js"...
I plan to create an object in a javascript file, and then use that object and it's methods on both the server and the client side. Assume an ASP file with the code 'var product = new Product();'
The following declaration in the javascript file works fine:
function Product () {}
function...
Adam, cheers for responding to my question. I'm not entirely sure what I want, but let me explain:
I have an application, with various functionalities. Thus, I have:
application={
interfaceCount:0,
init: function() {
}
registration: {
init: function() {
}...
parent is not a reserved word, although apparantly it is best to avoid it, as it may be a name of a client-side object, method, or property in Netscape Navigator or Internet Explorer (http://www.javascripter.net/faq/reserved.htm).
However, if I change the identifier, I still don't understand...
How do you have multiple child objects of a parent object? Consider the following object declaration:
var parent={
childCount: 0,
child: {
id:false,
init: function() {
alert(this.id);
parent.childCount++;
this.id = parent.childCount...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.