
Problem with DIV and <A> tag
I am trying to use
VBScript to dynamically change the href
of a hyperlink on the basis of a selection from 3
listboxes.
Whilst the line:
Document.Form1.lstMonth.style.visibility = "hidden"
(lstMonth is a SELECT object)
the following line does not
Document.Form1.hlink.href = "http//etc"
The error message is object does not support property.
Full script and html below.
I am running vbscript 5.6 and Vis Studio.net
Yours hopefully
Pete
Codebehind="MA.aspx.vb" Inherits="JGFinancial.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio.NET
7.0" name="GENERATOR">
<meta content="Visual Basic 7.0"
name="CODE_LANGUAGE">
<meta content="VBScript"
name="vs_defaultClientScript">
<meta
content=" http://www.*-*-*.com/ ;
name="vs_targetSchema">
<script language="vbscript"
id="clientEventHandlersVBS">
<!--
'http://localhost/JGFinancial/Mafiles/docdis.pdf
'<a id="HyperLink1"
href="http://localhost/JGFinancial/Mafiles/docdis.pdf"
style="width:280px;Z-INDEX: 114; LEFT: 39px; POSITION:
absolute; TOP: 355px">HyperLink</a>
Sub rdi_Onclick
dim myText()
dim myValue()
dim x
dim newOpt
dim newElement
dim hypo
if document.Form1.rdMgmtAcc.checked = true then
redim Mytext(9)
redim MyValue(9)
myText(0) = "Group Comparisons"
myValue(0) = "ga.pdf"
myText(1) = "Group Management Accounts"
myValue(1) = "magrp.pdf"
myText(2) = "Ipswich CMA"
myValue(2) = "maipscma.pdf"
myText(3) = "King's Lynn CMA"
myValue(3) = "malynCMA.pdf"
myText(4) = "Ipswich"
myValue(4) = "maips.pdf"
myText(5) = "Woodbridge"
myValue(5) = "mawoo.pdf"
myText(6) = "Diss"
myValue(6) = "madis.pdf"
myText(7) = "Lowestoft"
myValue(7) = "malow.pdf"
myText(8) = "King's Lynn"
myValue(8) = "malyn.pdf"
myText(9) = "Wisbech"
myValue(9) = "mawis.pdf"
document.Form1.lstMonth.style.visibility
= "visible"
document.Form1.lstYear.style.visibility = "visible"
Elseif document.Form1.rdBmi.checked = true then
redim MyText(8)
redim MyValue(8)
myText(0) = "Group Composite"
myValue(0) = "Bmgrp.pdf"
myText(1) = "Ipswich CMA"
myValue(1) = "bmipscma.pdf"
myText(2) = "King's Lynn CMA"
myValue(2) = "bmlynCMA.pdf"
myText(3) = "Ipswich"
myValue(3) = "bmips.pdf"
myText(4) = "Woodbridge"
myValue(4) = "bmwoo.pdf"
myText(5) = "Diss"
myValue(5) = "bmdis.pdf"
myText(6) = "Lowestoft"
myValue(6) = "bmlow.pdf"
myText(7) = "King's Lynn"
myValue(7) = "bmlyn.pdf"
myText(8) = "Wisbech"
myValue(8) = "bmwis.pdf"
document.Form1.lstMonth.style.visibility
= "visible"
document.Form1.lstYear.style.visibility = "visible"
Elseif document.Form1.rdDoc.checked = true then
redim MyText(7)
redim MyValue(7)
myText(0) = "Ipswich CMA"
myValue(0) = "docipscma.pdf"
myText(1) = "King's Lynn CMA"
myValue(1) = "doclynCMA.pdf"
myText(2) = "Ipswich"
myValue(2) = "docips.pdf"
myText(3) = "Woodbridge"
myValue(3) = "docwoo.pdf"
myText(4) = "Diss"
myValue(4) = "docdis.pdf"
myText(5) = "Lowestoft"
myValue(5) = "doclow.pdf"
myText(6) = "King's Lynn"
myValue(6) = "doclyn.pdf"
myText(7) = "Wisbech"
myValue(7) = "docwis.pdf"
document.Form1.lstMonth.style.visibility = "hidden"
document.Form1.lstYear.style.visibility = "hidden"
document.Form1.textbox1.style.visibility = "hidden"
stop
End if
Do while document.Form1.lstDealerhsip.options.length > 0
document.Form1.lstDealerhsip.options.remove(0)
loop
For x = 0 to ubound(myValue)
Set newOpt = document.createElement("OPTION")
newOpt.Value = myValue(x)
newOpt.Text = MyText(x)
document.Form1.lstDealerhsip.add(newOpt)
next
'<OPTION value="02">2002</OPTION>
End Sub
//-->
</script>
</HEAD>
<body ms_positioning="GridLayout">
<form id="Form1" style="FONT-FAMILY:
Arial" method="post" runat="server">
<LABEL id="mylabel" style="Z-
INDEX: 127; LEFT: 42px; POSITION: absolute; TOP: 336px"
ms_positioning="text2D">
<A id="hlink"
name="hlink"
href="http://localhost/JGFinancial/MAFiles/docdis.pdf">
A
hyperlink</A></LABEL> <INPUT language="vbscript"
id="rdMgmtAcc" style="Z-INDEX: 114; LEFT: 13px; POSITION:
absolute; TOP: 26px" onclick="rdi_Onclick" type="radio"
name="rdbuttons">
<DIV id="lblYear" style="DISPLAY:
inline; Z-INDEX: 115; LEFT: 393px; WIDTH: 70px; POSITION:
absolute; TOP: 65px; HEIGHT: 15px"
ms_positioning="FlowLayout">Year</DIV>
<SELECT id="lstYear2" style="Z-
INDEX: 116; LEFT: 391px; WIDTH: 54px; POSITION: absolute;
TOP: 104px; HEIGHT: 123px" size="7" name="lstYear">
<OPTION
value="02">2002</OPTION>
<OPTION
value="03">2003</OPTION>
<OPTION
value="04">2004</OPTION>
<OPTION
value="05">2005</OPTION>
<OPTION
value="06">2006</OPTION>
<OPTION
value="07">2007</OPTION>
<OPTION value=""></OPTION>
</SELECT>
<DIV id="lblMonth" style="DISPLAY:
inline; Z-INDEX: 117; LEFT: 272px; WIDTH: 70px; POSITION:
absolute; TOP: 66px; HEIGHT: 15px"
ms_positioning="FlowLayout">Month</DIV>
<SELECT id="lstMonth" style="Z-
INDEX: 118; LEFT: 266px; WIDTH: 89px; POSITION: absolute;
TOP: 101px; HEIGHT: 215px" size="13" name="lstMonth">
<OPTION
value="01">January</OPTION>
<OPTION
value="02">February</OPTION>
<OPTION
value="03">March</OPTION>
<OPTION
value="04">April</OPTION>
<OPTION
value="05">May</OPTION>
<OPTION
value="06">June</OPTION>
<OPTION
value="07">July</OPTION>
<OPTION
value="08">August</OPTION>
<OPTION
value="09">September</OPTION>
<OPTION
value="10">October</OPTION>
<OPTION
value="11">November</OPTION>
<OPTION
value="12">December</OPTION>
<OPTION value=""></OPTION>
</SELECT>
<DIV id="lblDealership"
style="DISPLAY: inline; Z-INDEX: 119; LEFT: 17px; WIDTH:
165px; POSITION: absolute; TOP: 68px; HEIGHT: 19px"
ms_positioning="FlowLayout">Dealership</DIV>
<DIV style="DISPLAY: inline; Z-
INDEX: 120; LEFT: 395px; WIDTH: 187px; POSITION: absolute;
TOP: 28px; HEIGHT: 19px" ms_positioning="FlowLayout">Daily
Operating Control</DIV>
<INPUT id="rdDoc" style="Z-INDEX:
121; LEFT: 365px; POSITION: absolute; TOP: 28px"
onclick="rdi_Onclick" type="radio" name="rdbuttons">
<SELECT id="lstDealerhsip"
style="Z-INDEX: 122; LEFT: 14px; WIDTH: 187px; POSITION:
absolute; TOP: 104px; HEIGHT: 175px" size="11"
name="lstDealership">
<OPTION
value="ga.pdf">Group Comparisons</OPTION>
<OPTION
value="magrp.pdf">Group Management Accounts</OPTION>
<OPTION
value="maipsCMA.pdf">Ipswich CMA</OPTION>
<OPTION
value="malynCMA.pdf">King's Lynn CMA</OPTION>
<OPTION
value="maips.pdf">Ipswich</OPTION>
<OPTION
value="mawoo.pdf">Woodbridge</OPTION>
<OPTION
value="madis">Diss</OPTION>
<OPTION
value="mawoo.pdf">Lowestoft</OPTION>
<OPTION
value="malynn.pdf">King's Lynn</OPTION>
<OPTION
value="mawis.pdf">Wisbech</OPTION>
</SELECT>
<DIV id="label1" title="rdbut1"
style="DISPLAY: inline; Z-INDEX: 123; LEFT: 40px; WIDTH:
196px; POSITION: absolute; TOP: 26px; HEIGHT: 22px"
ms_positioning="FlowLayout">Management
Accounts</DIV>
<INPUT id="rdBmi" style="Z-INDEX:
124; LEFT: 249px; POSITION: absolute; TOP: 28px"
onclick="rdi_Onclick" type="radio" name="rdbuttons">
<DIV style="DISPLAY: inline; Z-
INDEX: 125; LEFT: 277px; WIDTH: 74px; POSITION: absolute;
TOP: 29px; HEIGHT: 19px" ms_positioning="FlowLayout">Ford
Bmi</DIV>
<INPUT id="textbox1" style="Z-
INDEX: 126; LEFT: 403px; WIDTH: 299px; POSITION: absolute;
TOP: 270px; HEIGHT: 22px" type="text" size="44"
value="http://localhost/JGFinancial/Mafiles/docdis.pdf">
</form>
</body>
</HTML>