[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

Showing / Hiding Tables or Pictures in VBSCRIPT

I need some help creating an if Statement in VBScript.

I am using frontpage 2000 with vbScript code.

On the top of my page, i have some text boxes where the user enters values and press the button calculate.
I would like to show the bottom part of the screen where the result of the calculations are only showed when the user clicks the "Calculate" button. Before that, the user only sees the top of the page.

I have tried different approaches but the i have decided that two of them would be the more effective ones.
 1- I can cover the bottom half of the calculator with a picture and then when the button is clicked the picture disappears.
 2 - the sencod option would be creating an if statement where my html code will be added after the validation of the if stament. when i try that i get an error message. it seems like html code cannot go inside VBSCRIPT.

 so my questions would be. Do you know how to hide/show pictures in vbscript? Can html code be used inside vbscript section? if it is possible, how should i go about it?

if this helps:
the name of the picture is texas, the name of the form is Calculator
and the tables that i want to hide have several text boxes inside

Thanks in Advance,
Andre



 
0
virgilar
Asked:
virgilar
2 Solutions
 
YZlatCommented:
put your picture inside the <div> and then set visibility to false to make it invisible, and set it to true to mAKE YOUR IMAGE VISIBLE AGAIN:

<DIV ID="myDIV">
<img src="test.jpg">
</DIV>
0
 
suramsureshbabuCommented:
<html>
<head>
<script language=javascript>

function calculate() {

var div_ref = document.all("id_div");
  div_ref.style.visibility = "hidden";

var div_ref = document.all("id_div1");
  div_ref.style.visibility = "visible";
}
function recalculate() {

var div_ref = document.all("id_div");
  div_ref.style.visibility = "visible";

var div_ref = document.all("id_div1");
  div_ref.style.visibility = "hidden";
}

</script>
</head>
<body>
<form name=frm_test id=frm_test>


<div id=id_div1>

input1:<input type=text value="">
input2:<input type=text value="">
input3:<input type=text value="">
<input type=button Value=calculate onclick=recalculate()>
</div>



<div id=id_div style="top: 320; width:100%; visibility:hidden">
Result:
<input type=text value="">
<input type=button Value=Recalculate onclick=calculate()>
</div>

</form>
</body>
</html>
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now