View Full Version : Link url to result in resultbox.

03-16-2012, 04:31 PM
I am trying to set up a small legend type html. What I am trying to accomplish is to give the user a description depending on the abbv they pick from the drop down. This all works fine, however I now want to improve this to actually give them a link to a site if they want to research the description further. I can get it to work if I do document.write but I want the link to go into the text box. I also thought about making a button to the side that would probably need some sort of function to call each url. That may come down the road but the simpler way would be nice. I have a js called abbs there is actually two ways to do the drop downs but I am only concerned with adding links to the top one. On the CCVT option I have added a link but the only way I can get it to work is through document.write.

Here is my JS code:

function findMEAN(){ var abb = document.listNAME.abbWRD.value; if (abb == "AEP"){ abbs = ("American Electric Power") ;} else if (abb == "A"){ abbs = ("AMP") ;} else if (abb == "AC"){ abbs = ("ALTERNATING CURRENT") ;} else if (abb == "ACI"){ abbs = ("AMERICAN CONCRETE INSTITUTE") ;} else if (abb == "ACB"){ abbs = ("AIR CIRCUIT BREAKER") ;} else if (abb == "AISC"){ abbs = ("AMERICAN INSTITUTE OF STEEL CONSTRUCTION") ;} else if (abb == "ANSI"){ abbs = ("AMERICAN NATIONAL STANDARDS INSTITUTE") ;} else if (abb == "ARO"){ abbs = ("AUTOMATIC RECLOSING OPERATION") ;} else if (abb == "ASCE"){ abbs = ("AMERICAN SOCIETY OF CIVIL ENGINEERS") ;} else if (abb == "ASTM"){ abbs = ("AMERICAN SOCIETY FOR TESTING AND MATERIAL") ;} else if (abb == "AUX"){ abbs = ("AUXILUARY") ;} else if (abb == "AWG"){ abbs = ("AMERICAN WIRE GAUGE") ;} else if (abb == "BCT"){ abbs = ("BUSHING CURRENT TRANSFORMER") ;} else if (abb == "BIL"){ abbs = ("BASIC INSULATION LEVEL") ;} else if (abb == "BOM"){ abbs = ("BILL OF MATERIAL") ;} else if (abb == "BPD"){ abbs = ("BUSHING POTENTIOAL DEVICE") ;} else if (abb == "BPLC"){ abbs = ("BROADBAND POWER LINE CARRIER") ;} else if (abb == "BT"){ abbs = ("BUS TIE") ;} else if (abb == "CAB"){ abbs = ("CABLE") ;} else if (abb == "CAT#"){ abbs = ("CATALOG NUMBER") ;} else if (abb == "CB"){ abbs = ("CIRCUIT BREAKER") ;} else if (abb == "CCVT"){ abbs = ("COUPLING CAPACITOR VOLTAGE TRANSFORMER") ; abbslnk = "<p>Link: " + abbs.link("http://www.abb.com/product/db0003db002618/c12573e7003302adc1256ffd001d1256.aspx") + "</p>";} else if (abb == "CS"){ abbs = ("CIRCUIT SWITCHER") ;} else if (abb == "CT"){ abbs = ("CURRENT TRANSFORMER") ;} else if (abb == "CVT"){ abbs = ("CAPACITOR VOLTAGE TRANSFORMER") ;} else if (abb == "DC"){ abbs = ("DIRECT CURRENT") ;} else if (abb == "DEB"){ abbs = ("DOUBLE END BREAK") ;} else if (abb == "DMS"){ abbs = ("DATA MANAGEMENT SYSTEM/DIGITAL METERING SYSTEM") ;} else if (abb == "FDN"){ abbs = ("FOUNDATION") ;} else if (abb == "FMP"){ abbs = ("FIELD MARKED PRINT") ;} else if (abb == "GIS"){ abbs = ("GAS INSULATED SYSTEM") ;} else if (abb == "GND,GRDG"){ abbs = ("GROUND(ING)") ;} else if (abb == "GOAB"){ abbs = ("GAS OPREATED AIR BREAK") ;} else if (abb == "GOS"){ abbs = ("GANG OPREATED SWITCH") ;} else if (abb == "IFC"){ abbs = ("ISSUE FOR CONSTRUCTION") ;} else if (abb == "KA"){ abbs = ("KILO AMP") ;} else if (abb == "KCM"){ abbs = ("KILO(1000) CIRCULAR-MILS") ;} else if (abb == "KV"){ abbs = ("KILOVOLT") ;} else if (abb == "KVAR"){ abbs = ("KILOVOLT-AMPERES REACTIVE") ;} else if (abb == "LTC"){ abbs = ("LOAD TAP CHANGER") ;} else if (abb == "MLSE"){ abbs = ("MOST LIMITING SIGNIFICANT ELEMENT") ;} else if (abb == "MOAB"){ abbs = ("MOTOR OPERATED AIR BREAK") ;} else if (abb == "MOD"){ abbs = ("MOTOR OPERATED DISCONNECT") ;} else if (abb == "MR"){ abbs = ("MATERIAL REQUEST") ;} else if (abb == "MVAR"){ abbs = ("MEGAVOLT AMPERE REACTIVE") ;} else if (abb == "N.C."){ abbs = ("NORMALLY CLOSED") ;} else if (abb == "N.O."){ abbs = ("NORMALLY OPEN") ;} else if (abb == "NEMA"){ abbs = ("NATIONAL ELECTRICAL MANUFACTURER\'S ASSOCIATION") ;} else if (abb == "OCB"){ abbs = ("OIL CIRCUIT BREAKER") ;} else if (abb == "OEC"){ abbs = ("OUTSOURCED ENGINEERING COMPANY") ;} else if (abb == "OLD"){ abbs = ("ONE LINE DIAGRAM") ;} else if (abb == "OSHA"){ abbs = ("OCCUPATIONAL SAFETY AND HEALTH ADMINISTRATION") ;} else if (abb == "P&C"){ abbs = ("PROTECTION & CONTROL") ;} else if (abb == "PCIS"){ abbs = ("PROTECTION AND CONTROL INFORMATION SYSTEM") ;} else if (abb == "PCSS"){ abbs = ("PROTECTION & CONTROL SUPPORT SERVICES") ;} else if (abb == "PED"){ abbs = ("PROTECTION EXECUTION DOCUMENT") ;} else if (abb == "POP"){ abbs = ("PHASE OVER PHASE") ;} else if (abb == "PRA"){ abbs = ("PROJECT ROUTING & APPROVAL") ;} else if (abb == "PT"){ abbs = ("POTENTIAL TRANSFORMER") ;} else if (abb == "RIM"){ abbs = ("RELAY INSTRUMENTATION & METERING") ;} else if (abb == "RMS"){ abbs = ("ROOT MEAN SQUARE") ;} else if (abb == "RPA"){ abbs = ("R(TU) POINT ASSIGNMENT") ;} else if (abb == "RTU"){ abbs = ("REMOTE TERMINAL UNIT") ;} else if (abb == "S/N"){ abbs = ("SERIAL NUMBER") ;} else if (abb == "SA"){ abbs = ("SURGE ARRESTOR") ;} else if (abb == "SCADA"){ abbs = ("SUPERVISORY CONTROL AND DATA ACQUISITION") ;} else if (abb == "XF"){ abbs = ("TRANSFORMER") ;} else if (abb == "WD"){ abbs = ("WIRING DIAGRAM") ;} else if (abb == "VCB"){ abbs = ("VACUUM CIRCUIT BREAKER") ;} else if (abb == "V"){ abbs = ("VOLT") ;} else if (abb == "TCR"){ abbs = ("TRANSMISSION CONSTRUCTION REPRESENTATIVE") ;} else if (abb == "SW"){ abbs = ("SWITCH") ;} else if (abb == "SOW"){ abbs = ("SCOPE OF WORK") ;} else if (abb == "SESS"){ abbs = ("STATION ENGINEERING SUPPORT SERVICES") ;} { var result=document.getElementById("resultbox"); result.value = abbslnk }

Here is my HTML code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>ACRONYMS</title> <script type= "text/javascript" src="abbs.js"> </script> <style type="text/css" media="Screen"> fieldset { border: 5px solid #555555; padding: 20px; width:350px; word-wrap: normal; } </style> </head> <body> <fieldset style="width:410px; height: 250px"> <h2>DESCRIPTION BY ABBV</h2> <form name = "listNAME"> <select name="abbWRD"> <option value=A>A</option> <option value=AC>AC</option> <option value=ACB>ACB</option> <option value=ACI>ACI</option> <option value=AEP>AEP</option> <option value=AISC>AISC</option> <option value=ANSI>ANSI</option> <option value=ARO>ARO</option> <option value=ASCE>ASCE</option> <option value=ASTM>ASTM</option> <option value=AUX>AUX</option> <option value=AWG>AWG</option> <option value=BCT>BCT</option> <option value=BIL>BIL</option> <option value=BOM>BOM</option> <option value=BPD>BPD</option> <option value=BPLC>BPLC</option> <option value=BT>BT</option> <option value=CAB>CAB</option> <option value=CAT#>CAT#</option> <option value=CB>CB</option> <option value=CCVT>CCVT</option> <option value=CS>CS</option> <option value=CT>CT</option> <option value=CVT>CVT</option> <option value=DC>DC</option> <option value=DEB>DEB</option> <option value=DMS>DMS</option> <option value=FDN>FDN</option> <option value=FMP>FMP</option> <option value=GIS>GIS</option> <option value=GND,GRDG>GND,GRDG</option> <option value=GOAB>GOAB</option> <option value=GOS>GOS</option> <option value=IFC>IFC</option> <option value=KA>KA</option> <option value=KCM>KCM</option> <option value=KV>KV</option> <option value=KVAR>KVAR</option> <option value=LTC>LTC</option> <option value=MLSE>MLSE</option> <option value=MOAB>MOAB</option> <option value=MOD>MOD</option> <option value=MR>MR</option> <option value=MVAR>MVAR</option> <option value=N.C.>N.C.</option> <option value=N.O.>N.O.</option> <option value=NEMA>NEMA</option> <option value=OCB>OCB</option> <option value=OEC>OEC</option> <option value=OLD>OLD</option> <option value=OSHA>OSHA</option> <option value=P&C>P&C</option> <option value=PCIS>PCIS</option> <option value=PCSS>PCSS</option> <option value=PED>PED</option> <option value=POP>POP</option> <option value=PRA>PRA</option> <option value=PT>PT</option> <option value=RIM>RIM</option> <option value=RMS>RMS</option> <option value=RPA>RPA</option> <option value=RTU>RTU</option> <option value=S/N>S/N</option> <option value=SA>SA</option> <option value=SCADA>SCADA</option> <option value=SESS>SESS</option> <option value=SOW>SOW</option> <option value=SW>SW</option> <option value=TCR>TCR</option> <option value=V>V</option> <option value=VCB>VCB</option> <option value=WD>WD</option> <option value=XF>XF</option> </select> </form><br> <input value="Click for Description" onclick="findMEAN()" type="button"> </br></br> <input type="text" name="myresultbox" id="resultbox" style="width:400px; height:75px;"> </fieldset><br> <fieldset style="width:350px; height: 250px"> <h2>ABBV BY DESCRIPTION</h2> <form name = "listDESC"> <select name="abbABB"> <option value=A>AMP</option> <option value=AC>ALTERNATING CURRENT</option> <option value=ACB>AIR CIRCUIT BREAKER</option> <option value=ACI>AMERICAN CONCRETE INSTITUTE</option> <option value=AEP>AMERICAN ELECTRICAL POWER</option> <option value=AISC>AMERICAN INSTITUTE OF STEEL CONSTRUCTION</option> <option value=ANSI>AMERICAN NATIONAL STANDARDS INSTITUTE</option> <option value=ARO>AUTOMATIC RECLOSING OPERATION</option> <option value=ASCE>AMERICAN SOCIETY OF CIVIL ENGINEERS</option> <option value=ASTM>AMERICAN SOCIETY FOR TESTING AND MATERIAL</option> <option value=AUX>AUXILUARY</option> <option value=AWG>AMERICAN WIRE GAUGE</option> <option value=BCT>BUSHING CURRENT TRANSFORMER</option> <option value=BIL>BASIC INSULATION LEVEL</option> <option value=BOM>BILL OF MATERIAL</option> <option value=BPD>BUSHING POTENTIOAL DEVICE</option> <option value=BPLC>BROADBAND POWER LINE CARRIER</option> <option value=BT>BUS TIE</option> <option value=CAB>CABLE</option> <option value=CAT#>CATALOG NUMBER</option> <option value=CB>CIRCUIT BREAKER</option> <option value=CCVT>COUPLING CAPACITOR VOLTAGE TRANSFORMER</option> <option value=CS>CIRCUIT SWITCHER</option> <option value=CT>CURRENT TRANSFORMER</option> <option value=CVT>CAPACITOR VOLTAGE TRANSFORMER</option> <option value=DC>DIRECT CURRENT</option> <option value=DEB>DOUBLE END BREAK</option> <option value=DMS>DATA MANAGEMENT SYSTEM/DIGITAL METERING SYSTEM</option> <option value=FDN>FOUNDATION</option> <option value=FMP>FIELD MARKED PRINT</option> <option value=GIS>GAS INSULATED SYSTEM</option> <option value=GND,GRDG>GROUND(ING)</option> <option value=GOAB>GAS OPREATED AIR BREAK</option> <option value=GOS>GANG OPREATED SWITCH</option> <option value=IFC>ISSUE FOR CONSTRUCTION</option> <option value=KA>KILOAMP</option> <option value=KCM>KILO(1000) CIRCULAR-MILS</option> <option value=KV>KILOVOLT</option> <option value=KVAR>KILOVOLT-AMPERES REACTIVE</option> <option value=LTC>LOAD TAP CHANGER</option> <option value=MLSE>MOST LIMITING SIGNIFICANT ELEMENT</option> <option value=MOAB>MOTOR OPERATED AIR BREAK</option> <option value=MOD>MOTOR OPERATED DISCONNECT</option> <option value=MR>MATERIAL REQUEST</option> <option value=MVAR>MEGAVOLT-AMPERES REACTIVE</option> <option value=N.C.>NORMALLY CLOSED</option> <option value=N.O.>NORMALLY OPEN</option> <option value=NEMA>NATIONAL ELECTRICAL MANUFACTURER&apos;S ASSOCIATION</option> <option value=OCB>OIL CIRCUIT BREAKER</option> <option value=OEC>OUTSOURCED ENGINEERING COMPANY</option> <option value=OLD>ONE LINE DIAGRAM</option> <option value=OSHA>OCCUPATIONAL SAFETY AND HEALTH ADMINISTRATION</option> <option value=P&C>PROTECTION AND CONTROL</option> <option value=PCIS>PROTECTION AND CONTROL INFORMATION SYSTEM</option> <option value=PCSS>PROTECTION AND CONTROL SUPPORT SERVICES</option> <option value=PED>PROTECTION EXECUTION DOCUMENT</option> <option value=POP>PHASE OVER PHASE</option> <option value=PRA>PROJECT ROUTING AND APPROVAL</option> <option value=PT>POTENTIAL TRANSFORMER</option> <option value=RIM>RELAY INSTRUMENTATION AND METERING</option> <option value=RMS>ROOT MEAN SQUARE</option> <option value=RPA>R(TU) POINT ASSIGNMENT</option> <option value=RTU>REMOTE TERMINAL UNIT</option> <option value=S/N>SERIAL NUMBER</option> <option value=SA>SURGE ARRESTOR</option> <option value=SCADA>SUPERVISORY CONTROL AND DATA ACQUISITION</option> <option value=SESS>STATION ENGINEERING SUPPORT SERVICES</option> <option value=SOW>SCOPE OF WORK</option> <option value=SW>SWITCH</option> <option value=TCR>TRANSMISSION CONSTRUCTION REPRESENTATIVE</option> <option value=V>VOLT</option> <option value=VCB>VACUUM CIRCUIT BREAKER</option> <option value=WD>WIRING DIAGRAM</option> <option value=XF>TRANSFORMER</option> </select> </form><br> <input value="Click for ABBV" onclick="findABB()" type="button"> </br></br> <input type="text" name="myresultbox2" id="resultbox2" style="width:200px; height:75px;"> </fieldset><br> </body> </html>

So in summary everything is working just want to make the result in the result box be able to be clinked to a specific link assigned. Thank you in advance.

03-16-2012, 08:32 PM
Please try a repost of your code including line breaks ... otherwise you will most probably have to wait for an answer