ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 26th, 2011, 06:25 PM
allenrg967 allenrg967 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2011
Posts: 1 allenrg967 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 36 sec
Reputation Power: 0
Problems using vbscript InnerHTML in ASP

I am attempting to have an ASP page load a InnerHTML vbscript when loading to check for the presence of a file on the computer opening the web page. I am attempting to use innerHTML to display an extra cell in a table to display a link to allow the viewer to install the file if the script does not see it. I am getting no results (blank screen) with this and can't say that I am a great coder. I have removed alot of propriertary information, so if some of the code seems strange, that is why. Any help is appreciated.

Code:
<html>
	<head>
		<base target="_top">
		<link href="includes/Styles.css" rel="stylesheet" type="text/css">
		<script language="vbscript">
		  '==========================================================================
		  Function FileCheck()
		    Set objFSO = CreateObject("Scripting.FileSystemObject")
		    DataArea.InnerHTML = ""
			strHTML = "<table WIDTH='100%' CellPADDING='0' CELLSPACING='0' BORDER='0' BGCOLOR='#d6ecd8'>"
			strHTML = strHTML & "  <tr>"
			If objFSO.FileExists("C:\directory\file.txt") Then
				strHTML = strHTML & "    <td bgcolor='#5e6a71' valign='middle' align='center' colspan='3' style='height: 20px'>"
				strHTML = strHTML & "      <p class='small-white-title1'>Title</p>"
				strHTML = strHTML & "    </td>"
			Else
    			             strHTML = strHTML & "    <td bgcolor='#FBFAAE' valign='middle' align='center' colspan='3' style='height: 20px'>"
    			             strHTML = strHTML & "      <p style='vertical-align: middle' width='100%'><a href='' onclick='FileInstall' style=' font-family: Arial, Helvetica, sans-serif; font-size: x-small; color: #000000'><img src='images/title_install_icon.jpg' /> Click to install File.</a></p>"
    			             strHTML = strHTML & "	 </td>"
    			             strHTML = strHTML & "	 </tr><tr>"
    			             strHTML = strHTML & "	 <td BGCOLOR='#5e6a71' VALIGN='middle' ALIGN='center' COLSPAN='3' style='height: 20px'>"
    			             strHTML = strHTML & "	   <p class='small-white-title1'>Title</p>"
    			             strHTML = strHTML & "    </td>"
    		             End If
			strHTML = strHTML & "  </tr><tr bgcolor='#0046ad' height='20'>"
			strHTML = strHTML & "	<td width='25%'>"
			strHTML = strHTML & "	</td>"
			strHTML = strHTML & "	<td width='50%' align='center'>"
			strHTML = strHTML & "	</td>"
			strHTML = strHTML & "	<td width='25%'>"
			strHTML = strHTML & "	</td>"
			strHTML = strHTML & "  </tr>"
			strHTML = strHTML & "</table>"
			DataArea.InnerHTML = strHTML
		  End Function
		  '==========================================================================
		  Function Fileinstall()
			On Error Resume Next
			Set sho = CreateObject("WScript.Shell")
			err.clear
					sho.Run "xcopy /i /y \\server\share$\file.txt C:\directory\"
		  End Function
		  '==========================================================================		  
		</script>
	</head>
	<body onload="FileCheck()" topmargin="2" leftmargin="2" tabindex="-1">
	   <div>
                    <span id="DataArea"></span>
                </div>
   </body>
</html>

Reply With Quote
  #2  
Old January 26th, 2011, 07:44 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,237 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 50 m 19 sec
Reputation Power: 4445
You question seems to be entirely about client-side vbscript. My first recommendation is you use javascript for browser code, vbscript isn't universally supported.

Other guess, using the filesystem object on the client machine may be prevented by browser security settings. I don't know, I've never tried such code.

You may get better results in a browser-related forum, asp is server-side code.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Problems using vbscript InnerHTML in ASP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap