Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2003, 04:34 PM
Authorized User
 
Join Date: Jul 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ALoPresto
Default Using VBScript to update content w/o page refresh

Hi. Using ASP and VBScript, I would like to update the current page's source code without refreshing the page. I have a drop down combo, and onChange runs a VBScript function. The VBScript function then stores new source code to a variable, which I would like to then insert into the page. Is there any way to do this? Currently the drop down changes, the function executes, and the page moves to a new page with only the source code which I store to the variable. I know how to use VBScript to update form fields, etc, but this isn't quite the same. If someone knows how to make this work, I'd be much obliged. Thank you.
__________________
Andy
AIM: LoPrestoAtWork

Trusant Technologies, LLC
 
Old July 10th, 2003, 07:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

If you only wish to change a bit of text on the page you can use the innerHTML element of a <DIV> tag.
So you have a div tag on the page with nothing in it, when the drop down changes you change the innerHTML property of the div tag to the variables contents.
I do this in Javascript and do not know the VBScript clientside code syntax off hand but it should not be to hard to find.
If you need to do more than that you may be able to use a combination of hidden div tags and innerhtml. Let us know more about what you need to do? What kend of source code? etc.
Essentially, I don't think you can change source code, but you can change whether or not you can see it, and the text within it.
 
Old July 11th, 2003, 12:53 PM
Authorized User
 
Join Date: Jul 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ALoPresto
Default

Thank you much. The suggestion you gave worked beautifully. I'll post an example of the VBScript code in case anyone is curious.

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="trusant_css.css" rel="stylesheet" type="text/css">
<script language="VBScript">
sub dropdown(div)
    Execute("document.all." & div & ".innerHTML = ""<%= "this is asp" %>""") 
end sub
</script>
</head>

<body>
<a href="#" onClick="dropdown('mydiv')">Click to add text</a>
<div id="mydiv">

</div>
Other text
</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh Listview after Database Update neo_jakey Pro VB 6 8 March 14th, 2011 04:33 AM
Master Page Method: Code-Behind for Content Page kwilliams ASP.NET 2.0 Professional 3 June 2nd, 2008 12:57 PM
update rows with vbscript in asp sanjeev jha Classic ASP Professional 1 November 12th, 2007 03:24 AM
Master Page refresh only the content skyler ASP.NET 2.0 Professional 5 May 2nd, 2007 06:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.