Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Display Date With Vb In Html


  • Please log in to reply
5 replies to this topic

#1 Treikayan

Treikayan

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:01:37 AM

Posted 15 February 2007 - 12:03 PM

Hello,

I'm having trouble displaying the date in an HTML document. Any pointers on some VB code? I have the span id set as "wdate," but I'm having trouble writing the code in VB.

Thank you. :thumbsup:
Procrastinate Now!!!

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:37 PM

Posted 15 February 2007 - 12:31 PM

Does it have to be VB? Can you use JavaScript?
<script LANGUAGE="Javascript">
<!-- 

// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
				"Thursday","Friday","Saturday");

// Array of month Names
var monthNames = new Array(
"January","February","March","April","May","June","July",
"August","September","October","November","December");

var now = new Date();
document.write(dayNames[now.getDay()] + ", " + 
monthNames[now.getMonth()] + " " + 
now.getDate() + ", " + now.getFullYear());

// -->
</SCRIPT>

Or did you really mean VBScript
<script language="VBSCRIPT">
<!--
	Document.Write(Date) 
//-->
</script>

Or did you really want VB? Maybe we could be more helpful if you showed us the code that you had.

#3 Treikayan

Treikayan
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:01:37 AM

Posted 15 February 2007 - 02:18 PM

Thank you for the assistance. Both ways work nicely. :flowers:

I'm a beginner programmer. I couldn't believe how easy the VB script really was. I was making harder than I needed to.

:thumbsup:
Procrastinate Now!!!

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:37 PM

Posted 15 February 2007 - 02:56 PM

Actually, I can't take any credit for either of those.... I just did a quick Google for them. :thumbsup:

#5 Treikayan

Treikayan
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:01:37 AM

Posted 23 April 2007 - 10:22 AM

I've got the date properly displaying, but now I'm having problems getting the COMPUTERNAME to properly display. Any pointers?

This is what I have:

<script language="VBScript">
Dim CompName
Set WshNetwork = WScript.CreateObject("WScript.Network")
CompName = WshNetwork.ComputerName
Document.Write(CompName)
</script>

It's not writing the ComputerName on the HTML document...
Procrastinate Now!!!

#6 Treikayan

Treikayan
  • Topic Starter

  • Members
  • 57 posts
  • OFFLINE
  •  
  • Local time:01:37 AM

Posted 02 May 2007 - 08:49 PM

I found out how to fix this:

I'm using IE for my VB Script.

oIE.document.all.wcomp.InnerText = WshNetwork.ComputerName


This is the line of code I had in the script. My problem was on IE. I missed a stupid quotation mark on defining the "wcomp" <SPAN> tags. Grrrr.

<span id="wcomp" name="wcomp">


Edited by Treikayan, 02 May 2007 - 08:50 PM.

Procrastinate Now!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users