Home: General Discussions: General Questions:
VB script question ( hey u said any non-pearl ;) )



Always IN Chaos
Novice

Apr 26, 2003, 12:19 AM


Views: 12196
VB script question ( hey u said any non-pearl ;) )

Hey guys been a while lol, I still know nothing!

I would like to use this vbcode as vbscript on a page buy it's not working for me. :(

here's the code :

Code
Private Sub Command1_Click() 
Dim a As String
a = 0
If Text2.Text = 0 Then
a = 1
ElseIf Text2.Text = 1 Then
a = 0.7
ElseIf Text2.Text = 2 Then
a = 0.7 * 0.7
ElseIf Text2.Text = 3 Then
a = 0.7 * 0.7 * 0.7
ElseIf Text2.Text = 4 Then
a = 0.7 * 0.7 * 0.7 * 0.7
ElseIf Text2.Text = 5 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7
ElseIf Text2.Text = 6 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7
ElseIf Text2.Text = 7 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7

Else
End If
If Text1.Text = "" Then
MsgBox "put something in for x buttmunch", vbOKOnly
ElseIf Text3.Text = "" Then
MsgBox "please fill in the rest of the boxes before i calculte, or i will download porn onto your computer!!!", vbOKOnly
Else
Text4.Text = (Text1.Text * Text1.Text) * 0.13 * (a) / Text3.Text
Text5.Text = (Text1.Text) * 0.169
Text7.Text = ((Text6.Text) * (1.5)) / 15.3
End If
End Sub


If you guys could Help i'd love ya for ever.

posted this here cause I dont know where else to go to get honest helpful advise.


Paul
Enthusiast

Apr 26, 2003, 7:03 AM


Views: 12192
Re: [Always IN Chaos] VB script question ( hey u said any non-pearl ;) )

Most of that code should work, it's just the Text1.Text and Text2.Text parts that won't as they are referencing text box controls that obviously don't exist on your web page.

To get the value I think you can use:

Document.MyForm.MyBox.Value


(This post was edited by Paul on Apr 26, 2003, 7:04 AM)


Always IN Chaos
Novice

Apr 26, 2003, 4:01 PM


Views: 12184
Re: [Paul] VB script question ( hey u said any non-pearl ;) )

so for text2 it would be

Document.MyFormname.Text2.Value

?


Paul
Enthusiast

Apr 26, 2003, 4:48 PM


Views: 12183
Re: [Always IN Chaos] VB script question ( hey u said any non-pearl ;) )

Yeah assuming the name of the html field is "Text2"


Always IN Chaos
Novice

Apr 28, 2003, 12:05 AM


Views: 12178
Re: [Paul] VB script question ( hey u said any non-pearl ;) )

Aight that works great :-D
Here's a question I just came up with.

Is there a way to have a page come up in a specific size and with-out all the menus, just the title bar ( and if u can do it with out that it would be better :-D ) and the content window without it being a pop-up.

Meaning if I say goto "http://yahoo.com" it opens with nothing but the page content and is a specific size such as 800x 100 . ??

Thankies for everything thus far.


Paul
Enthusiast

Apr 28, 2003, 3:57 AM


Views: 12175
Re: [Always IN Chaos] VB script question ( hey u said any non-pearl ;) )

You'd probably have to use showModalDialog() (with javascript) but unfortunately only IE implements this function.

See:

http://dhtmlshock.com/window-scripts/Chromeless/default.asp


Always IN Chaos
Novice

Apr 28, 2003, 5:03 PM


Views: 12171
Re: [Paul] VB script question ( hey u said any non-pearl ;) )

Your the man! lol
Is there a way to make dockable windows or "always on top" windows ?

That chrome window thing is awesome tho :-D


Always IN Chaos
Novice

Apr 29, 2003, 5:25 PM


Views: 12164
Re: [Always IN Chaos] VB script question ( hey u said any non-pearl ;) )

Also
A thing just came up with that link you sent me, I used it and from work it was working fine on IE 6.0, at home on IE 6.0 SP1 the "window" automaticly opens to full screen and cant be resized by dragging on the corners, do you think a resize java script would work on that? if so how do you do that, ( I've seen an example somewhere's but have forgotten where.

Thankies.


Always IN Chaos
Novice

May 3, 2003, 1:27 AM


Views: 12151
Re: [Always IN Chaos] VB script question ( hey u said any non-pearl ;) )


Code
<script language="VBScript"> 
<!--
Private Sub CalcAttack_OnClick()
Dim a
Dim b
Dim intAns

a = 0
If Document.Form1.Text2.Value = 0 Then
a = 1
ElseIf Document.Form1.Text2.Value = 1 Then
a = 0.7
ElseIf Document.Form1.Text2.Value = 2 Then
a = 0.7 * 0.7
ElseIf Document.Form1.Text2.Value = 3 Then
a = 0.7 * 0.7 * 0.7
ElseIf Document.Form1.Text2.Value = 4 Then
a = 0.7 * 0.7 * 0.7 * 0.7
ElseIf Document.Form1.Text2.Value = 5 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7
ElseIf Document.Form1.Text2.Value = 6 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7
ElseIf Document.Form1.Text2.Value = 7 Then
a = 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7 * 0.7
Else
End If

b = 0
If Document.Form1.AttackShipsLevel.Value = 0 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 1 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 2 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 3 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 4 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 5 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 6 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 7 Then
b = 1
ElseIf Document.Form1.AttackShipsLevel.Value = 8 Then
b = 11.9
Else
End If
If Document.Form1.AttackShipsLevel.Value = "0" Then
MsgBox "put the level in dumbass (1-8)", vbOKOnly
Else

AttackPWR =(Document.Form1.Ships.Value) * (b)
Land = (Document.Form1.Text1.Value * Document.Form1.Text1.Value ) * 0.13 * (a) / Document.Form1.Text3.Value
MaxLand = (Document.Form1.Text1.Value ) * 0.169
Ships = ((Document.Form1.Text6.Value ) * (1.5)) / 15.3
intAns = AttackPWR
Document.Form1.Results.Value = intAns

End If
End Sub
-->
</Script>


Thats what I currently have, my question of the day, hehe is How can I make The Result (Textarea box) box display all varribles with text before them like.

Attack Power : AttackPWR(<--varrable)