java

LOL, after I put the script section after the html I started getting an object expected error. Unless I put it in the wrong spot.

</script>
<html>
<body>
<form name="form1">
<table border=1>
<tr>
<td>
<select name="dropdn1" OnChange="change_form();">
<option name="val1" value="val1" SELECTED>val1</option>
<option name="val2" value="val2">val2</option>
</select>
</td>
<td>
<div id="formxyz">
<select name="subselect">
<option value="1" name="1">1a</option>
<option value="1" name="1">2a</option>
<option value="1" name="1">3a</option>
<option value="1" name="1">4a</option>
</select>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>

<script>
function change_form()
{
var el = document.getElementById? document.getElementById('formxyz'): document.all['formxyz'];
var formx1 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1a</option><option value=\"1\" name=\"1\">2a</option><option value=\"1\" name=\"1\">3a</option><option value=\"1\" name=\"1\">4a</option></select>";
var formx2 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1b</option><option value=\"1\" name=\"1\">2b</option><option value=\"1\" name=\"1\">3b</option><option value=\"1\" name=\"1\">4b</option></select>";
if (document.form1.dropdn1.value=="val1")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx1;
}
if (document.form1.dropdn1.value=="val2")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx2;
}
}

Alright there's gotta be something missing in my text above these lines that im missing because I copied this text into a new blank html and it worked. Can you take some time to look at the text up to yours?
 
<html>

<head>

<SCRIPT LANGUAGE="JavaScript">
<!--
function dmsJS_submitHrefSearchCIVARC(){document.submitSearchCIVARC.submit()}
function dmsJS_submitHrefSearchELEC(){document.submitSearchELEC.submit()}
function dmsJS_submitHrefSearchINSTR(){document.submitSearchINSTR.submit()}
function dmsJS_submitHrefSearchMECH(){document.submitSearchMECH.submit()}
function dmsJS_submitHrefSearchPROCESS(){document.submitSearchPROCESS.submit()}
// -->
</SCRIPT>



<STYLE type="text/css">
.body {
color: #000000;
font-family: Verdana;
font-weight: normal;
font-size:9pt;
}
.form {
color: #404040;
font-size:8pt;
margin-top: 0px;
font-family: verdana;
font-weight:normal;
font-variant:small-caps;
}

.docsearch {
color: #404040;
font-size:10pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

.quicksearch {
color: ##000080;
font-size:9pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

.date {
margin-left:10px;
margin-right:5px;
color: #cccc99;
font-size:8pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

A:link {
COLOR: blue;
TEXT-DECORATION: none
}

A:visited {
COLOR: blue;
TEXT-DECORATION: none
}

A:active {
COLOR: blue;
TEXT-DECORATION: none
}

A:hover {
TEXT-DECORATION: underline
}

</STYLE>

</head>

<SCRIPT src="http://hscnt7.americas.dowcornusa.com/engserv/functions.js"></SCRIPT>



<basefont face="Arial" color="BLACK" size=3>


<!--webbot bot="Include" U-Include="header.htm" TAG="BODY" startspan --><p><em>[header.htm]</em></p>
<!--webbot bot="Include" endspan i-checksum="902" --><p> </p>

<div align="center">
<center>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" width="864">
<TR><TD HEIGHT="20" align="center" width="220"></TD></TR>
<TR>

<!-- START INTRO PANEL -->
<TD VALIGN="TOP" align="center" width="220">
<div align="center">
<center>
<TABLE WIDTH="192" BORDER="0" CELLSPACING="0" CELLPADDING="5">
<TR><TD width="180"><img border="0" src="images/falcon.gif" width="95" height="72"></TD></TR>
</center>
</center>
<TR><TD bgcolor="#FFFFFF" width="180">
<p align="left">
<span class=body><font color="#000080"><b>Welcome to the Search/View/Print page. </b></font><br>
<br>
Engineering documents and drawings are available to search, view,
and print through the intranet.<br>
<br>
Documents and drawings may be accessed using a variety of search criteria or with quick searches.</span>
<p align="left">
<span class=body><b><font size="2"><span style="background-color: #FFFF00"><a href="javascript:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/downloadinstructions.htm',475,475)">Drawing
Viewer Update</a></span>  </font></b>
</span></p>
<p align="left">
<span class=body><b>First time users</b>:  To view drawings <a href="javascript:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/downloadinstructions.htm',475,475)">download
the viewer.</a><br>
<br>
<a href="javascript:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/searchtipstable.htm',500,600)">
Tips for searching</a>  <br>
<a href="javascript:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/viewingtips.htm',625,400)">Tips for
viewing drawings<br>
</a> <br>
</span><a href="http://corpnt4c/engineering/default.htm"><img border="0" src="Images/ezweb.gif" width="168" height="22"></a></p>
</TD>
<center>

<center>
<TR><TD height="30" valign="bottom" width="180"> 
<p> </TD></TR>
</TABLE>
</center>
</div>
</center>
</TD>
<!-- END INTRO PANEL -->
<TD WIDTH="6" align="center"></TD>
<!-- START SEARCH FORM -->
<TD VALIGN="TOP" align="center" width="360">

<table width="360" cellpadding="2" border="0" align="center">
<form action='/scripts/falcon/dmswebs.exe' method='POST' Name='submitSearch'>
<input type=hidden name="startForm">
<input type=hidden name="RequestMode" value="JobRequestMode">
<input type=hidden name="SessionID" value="userid">
<TR>
<TD HEIGHT="30" COLSPAN="3" ALIGN="CENTER" VALIGN="TOP"><span class=docsearch> EMTN Search</span></TD></TR>
<tr>
<td align="left"><span class=form>DESCRIPTION</td>
<td align="left"><INPUT TYPE=text Name="Description" Size=30></td>

<script>
function change_form()
{
var el = document.getElementById? document.getElementById('formxyz'): document.all['formxyz'];
var formx1 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1a</option><option value=\"1\" name=\"1\">2a</option><option value=\"1\" name=\"1\">3a</option><option value=\"1\" name=\"1\">4a</option></select>";
var formx2 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1b</option><option value=\"1\" name=\"1\">2b</option><option value=\"1\" name=\"1\">3b</option><option value=\"1\" name=\"1\">4b</option></select>";
if (document.form1.dropdn1.value=="val1")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx1;
}
if (document.form1.dropdn1.value=="val2")
{
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx2;
}
}



</script>
<html>
<body>
<form name="form1">
<table border=1>
<tr>
<td>
<select name="dropdn1" OnChange="change_form();">
<option name="val1" value="val1" SELECTED>val1</option>
<option name="val2" value="val2">val2</option>
</select>
</td>
<td>
<div id="formxyz">
<select name="subselect">
<option value="1" name="1">1a</option>
<option value="1" name="1">2a</option>
<option value="1" name="1">3a</option>
<option value="1" name="1">4a</option>
</select>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
</script>
<html>
<body>
 
Sorry I know there's a little bit of extra information there but theres gotta be something I am missing I just cant see it for some reason.
 
The problem was that the form you started wasn't closed, the the object document.form1.dropdn didn't exists it was document.seachsubmit.form1.dropdn
I'm not sure you can nest forms and still refere to them in javascript. anyway, the easiest thing to do was remove the second form opening tag (form name="form1">
and change the script at the top to refere to the correct form.
I left the </form> tage so that your form was closed.
Code:
<html>

<head>

<SCRIPT LANGUAGE="JavaScript">
<!--
function dmsJS_submitHrefSearchCIVARC(){document.submitSearchCIVARC.submit()}
function dmsJS_submitHrefSearchELEC(){document.submitSearchELEC.submit()}
function dmsJS_submitHrefSearchINSTR(){document.submitSearchINSTR.submit()}
function dmsJS_submitHrefSearchMECH(){document.submitSearchMECH.submit()}
function dmsJS_submitHrefSearchPROCESS(){document.submitSearchPROCESS.submit()}
// -->

function change_form()
{
var el = document.getElementById? document.getElementById('formxyz'): document.all['formxyz'];
var formx1 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1a</option><option value=\"1\" name=\"1\">2a</option><option value=\"1\" name=\"1\">3a</option><option value=\"1\" name=\"1\">4a</option></select>";
var formx2 = "<select name=\"subselect\"><option value=\"1\" name=\"1\">1b</option><option value=\"1\" name=\"1\">2b</option><option value=\"1\" name=\"1\">3b</option><option value=\"1\" name=\"1\">4b</option></select>";
if (document.submitSearch.dropdn1.value=="val1") 
{ 
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx1;
}
if (document.submitSearch.dropdn1.value=="val2") 
{ 
if (el && typeof el.innerHTML != "undefined") el.innerHTML = formx2;
}
}
</SCRIPT>

<STYLE type="text/css">
.body {
color: #000000;
font-family: Verdana; 
font-weight: normal; 
font-size:9pt;
}
.form {
color: #404040;
font-size:8pt;
margin-top: 0px;
font-family: verdana;
font-weight:normal;
font-variant:small-caps;
}

.docsearch {
color: #404040;
font-size:10pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

.quicksearch {
color: ##000080;
font-size:9pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

.date {
margin-left:10px;
margin-right:5px;
color: #cccc99;
font-size:8pt;
margin-top: 0px;
font-family: verdana;
font-weight:bold;
font-variant:small-caps;
}

A:link {
COLOR: blue;
TEXT-DECORATION: none
}

A:visited {
COLOR: blue;
TEXT-DECORATION: none
}

A:active {
COLOR: blue;
TEXT-DECORATION: none
}

A:hover {
TEXT-DECORATION: underline
}

</STYLE>

</head>

<SCRIPT src="http://hscnt7.americas.dowcornusa.com/engserv/functions.js"></SCRIPT>



<basefont face="Arial" color="BLACK" size=3>


<!--webbot bot="Include" U-Include="header.htm" TAG="BODY" startspan --><p><em>[header.htm]</em></p>
<!--webbot bot="Include" endspan i-checksum="902" --><p> </p>

<div align="center">
<center>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" width="864">
<TR><TD HEIGHT="20" align="center" width="220"></TD></TR>
<TR>

<!-- START INTRO PANEL -->
<TD VALIGN="TOP" align="center" width="220">
<div align="center">
<center>
<TABLE WIDTH="192" BORDER="0" CELLSPACING="0" CELLPADDING="5">
<TR><TD width="180"><img border="0" src="images/falcon.gif" width="95" height="72"></TD></TR>
</center>
</center>
<TR><TD bgcolor="#FFFFFF" width="180">
<p align="left">
<span class=body><font color="#000080"><b>Welcome to the Search/View/Print page. </b></font><br>
<br>
Engineering documents and drawings are available to search, view,
and print through the intranet.<br>
<br>
Documents and drawings may be accessed using a variety of search criteria or with quick searches.</span>
<p align="left">
<span class=body><b><font size="2"><span style="background-color: #FFFF00"><a href="java script:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/downloadinstructions.htm',475,475)">Drawing
Viewer Update</a></span>  </font></b>
</span></p>
<p align="left">
<span class=body><b>First time users</b>:  To view drawings <a href="java script:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/downloadinstructions.htm',475,475)">download
the viewer.</a><br>
<br>
<a href="java script:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/searchtipstable.htm',500,600)">
Tips for searching</a>  <br>
<a href="java script:newWindow('http://hscnt7.americas.dowcornusa.com/falcon/searchtips/viewingtips.htm',625,400)">Tips for
viewing drawings<br>
</a> <br>
</span><a href="http://corpnt4c/engineering/default.htm"><img border="0" src="Images/ezweb.gif" width="168" height="22"></a></p>
</TD>
<center>

<center>
<TR><TD height="30" valign="bottom" width="180"> 
<p> </TD></TR>
</TABLE>
</center>
</div>
</center>
</TD>
<!-- END INTRO PANEL -->
<TD WIDTH="6" align="center"></TD>
<!-- START SEARCH FORM -->
<TD VALIGN="TOP" align="center" width="360">

<table width="360" cellpadding="2" border="0" align="center"> 
<form action='/scripts/falcon/dmswebs.exe' method='POST' Name='submitSearch'>
<input type=hidden name="startForm">
<input type=hidden name="RequestMode" value="JobRequestMode">
<input type=hidden name="SessionID" value="userid">
<TR>
<TD HEIGHT="30" COLSPAN="3" ALIGN="CENTER" VALIGN="TOP"><span class=docsearch> EMTN Search</span></TD></TR>
<tr> 
<td align="left"><span class=form>DESCRIPTION</td>
<td align="left"><INPUT TYPE=text Name="Description" Size=30></td>



<table border=1>
<tr>
<td>
<select name="dropdn1" OnChange="change_form();">
<option name="val1" value="val1" SELECTED>val1</option>
<option name="val2" value="val2">val2</option>
</select>
</td>
<td>
<div id="formxyz">
<select name="subselect">
<option value="1" name="1">1a</option>
<option value="1" name="1">2a</option>
<option value="1" name="1">3a</option>
<option value="1" name="1">4a</option>
</select>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
</script>
<html>
<body>
 
Hey root I got it working now, I ended up just taking that Intro Panel out and it worked but now I guess I can put it back in. Thanks for everyting I finally got it working the way I need.
 
Thanks great script

I'm sure other one would have worked better but was too complicated for me to customise for my site :(

But this one will do for now... :)

and root if your feeling bored at any point in the next month :rolleyes: you could always edit it for me lol:D :D if you want to msn me @ whizzell@hotmail.co.uk...

thanx from whizzell and i'm sure dude_se aswell



seriously, I'd avise that you look for a nicer menu than a select box, as it's a form control is worked nicely for midntcowboy25's search and subsearch idea...
you'd do better searching somewhere like Javaboutique.internet.com for better menus...

however if you really want to have menus that are select boxes then here you are.

Code:
<script>
function navigate()
{
var menval=document.frm.menu.value;
document.location = (menval);
}
</script>

<body>
<form name="frm">
<select name="menu" Onchange="navigate();">
<option name="1" value="page1.html">1</option>
<option name="2" value="page2.html">2</option>
<option name="3" value="page3.html">3</option>
</select>
</form>
</body>
 
Thanks great script

I'm sure other one would have worked better but was too complicated for me to customise for my site :(

But this one will do for now... :)

and root if your feeling bored at any point in the next month :rolleyes: you could always edit it for me lol:D if you want to msn me @ whizzell@hotmail.co.uk...

thanx from whizzell and i'm sure dude_se aswell

change your email to whizzell AT hotmail.co.uk to avoid spam and post this in your thread aswell for a better response. just a tip ;)
 
Back
Top Bottom