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 October 14th, 2010, 08:28 AM
Vipe Vipe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 1 Vipe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 6 sec
Reputation Power: 0
Question VBscript Prime #'s in textbox?

Hi i'm writing a VBscript that should output all of Prime numbers inside a textbox.. so far i've been able to create a code that prints all of the prime number below 100 but im having a problem putting them inside the textbox... i dont have any idea on how to loop a texbox with different value..

heres my code:
Code:
<html> 
<body> 
<script type="text/vbscript">
For num = 3 To 100 Step 2 
   bIsPrime = True
   For i = 2 To num\2 
      bIsPrime = num Mod i > 0 
      If Not bIsPrime then exit for 
   Next
   If bIsPrime Then 
      document.write(num & "<input type='text' size=10><br/>")
   end if
Next 
</script> 
</body> 
</html>


sorry but i'm just a newbie on scripting...
i need help on how to put the value i looped inside the textbox..

thanks for reading..

Reply With Quote
  #2  
Old October 14th, 2010, 01:37 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 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 18 h 51 m 19 sec
Reputation Power: 4445
I suspect you'll need to find the answer in a html/DOM oriented forum, structurally your vbscript appears correct.

I'd recommend not using vbscript for browser code anyway, javascript is better for browser-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
  #3  
Old November 20th, 2010, 12:47 PM
Satellite55 Satellite55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 15 Satellite55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 33 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by Vipe
Hi i'm writing a VBscript that should output all of Prime numbers inside a textbox.. so far i've been able to create a code that prints all of the prime number below 100 but im having a problem putting them inside the textbox... i dont have any idea on how to loop a texbox with different value..

heres my code:
Code:
<html> 
<body> 
<script type="text/vbscript">
For num = 3 To 100 Step 2 
   bIsPrime = True
   For i = 2 To num\2 
      bIsPrime = num Mod i > 0 
      If Not bIsPrime then exit for 
   Next
   If bIsPrime Then 
      document.write(num & "<input type='text' size=10><br/>")
   end if
Next 
</script> 
</body> 
</html>


sorry but i'm just a newbie on scripting...
i need help on how to put the value i looped inside the textbox..

thanks for reading..



if your function is working...
then the output can be added like this:

document.write( "<input type='text' size='10' value=''' & num & "'><br/>")

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > VBscript Prime #'s in textbox?

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