Here is my code, and it's not working. Please help me get through
this. I've read every single tutorial and you may even see remnants of
some of their variables in my code. I don't know if I'm close, but I
feel that I'm getting there.
Thanks in advance for any help. I much appreciate it.
-pk
<SCRIPT>
function able(dropdown)
{
var myindex = dropdown.select edIndex
if(myindex = 1) {
MMDiv.style.vis ibility='visibl e';
mainform.BalSte p.focus();
}
else {
MMDiv.style.vis ibility='hidden ';
}
</SCRIPT>
<Form Name="myform">
<tr>
<td height="7" width="177">
<div align="right">< font color="#000000" face="Comic Sans MS">Boring
Type:</font></div>
</td>
<td height="7" width="397"><di v align="left"><f ont color=#000000
face="Comic Sans MS">
<select name=Finish onchange='able( this.form.Finis h);'>
<option></option>
<option>Rough </option>
<option>Finis h</option>
</select></font></div></td>
<DIV ID="MMDiv" style="visibili ty:hidden">
<LABEL FOR="BalStep">
<SELECT name=BalStepVal >
<option></option>
<option>Balance d Cutting</option>
<option>Step Cutting</option>
</SELECT>
</DIV>
</FORM>
</tr> 7 2041
pk said: Here is my code, and it's not working. Please help me get through this. I've read every single tutorial and you may even see remnants of some of their variables in my code. I don't know if I'm close, but I feel that I'm getting there.
Thanks in advance for any help. I much appreciate it.
-pk
<SCRIPT>
The SCRIPT tag requires a "type" attribute:
<script type="text/javascript">
function able(dropdown) { var myindex = dropdown.select edIndex if(myindex = 1) {
The "=" sign is the assignment operator, not the comparison
operator. You want:
if (myindex == 1) {
MMDiv.style.vis ibility='visibl e';
Don't refer to a page element by its ID value as if it were global.
It is in some browsers, but it's non-standard and poor practice.
document.getEle mentById("MMDiv ").style.visibi lity="visible";
mainform.BalSte p.focus();
The same goes for forms, although they can be referred to as
attributes of the document, as in:
document.mainfo rm.BalStep.focu s();
<select name=Finish onchange='able( this.form.Finis h);'>
The value of the name attribut should be in quotes.
The keyword "this" is already a reference to "Finish":
<select name="Finish" onchange="able( this)">
Hmm, I wasn't very close at all. I'm still not getting it. My code
appears as follows now. There is still no observable behavior. :(
<SCRIPT type="text/javascript"> >
function able(dropdown)
{
var myindex = dropdown.select edIndex
if(myindex == 1) {
document.getEle mentById("MMDiv ").style.visibi lity="visible";
document.mainfo rm.BalStep.focu s();
}
else
{
document.getEle mentById("MMDiv ").style.visibi lity='hidden';
}
</SCRIPT>
<Form Name="myform">
<tr>
<td height="7" width="177">
<div align="right">< font color="#000000" face="Comic Sans MS">Boring
Type:</font></div>
</td>
<td height="7" width="397"><di v align="left"><f ont color=#000000
face="Comic Sans MS">
<select name="Finish" onchange='able( this);'>
<option></option>
<option>Rough </option>
<option>Finis h</option>
</select></font></div></td>
<DIV ID="MMDiv" style="visibili ty:hidden">
<LABEL FOR="BalStep">
<SELECT name=BalStepVal >
<option></option>
<option>Balance d Cutting</option>
<option>Step Cutting</option>
</SELECT>
</DIV>
</FORM>
</tr>
pk wrote: Here is my code, and it's not working. Please help me get through this. I've read every single tutorial and you may even see remnants of some of their variables in my code. I don't know if I'm close, but I feel that I'm getting there.
Thanks in advance for any help. I much appreciate it.
-pk
<SCRIPT>
function able(dropdown) { var myindex = dropdown.select edIndex if(myindex = 1) { MMDiv.style.vis ibility='visibl e';
document.getEle mentById('MMDiv ').style.visibi lity='visible';
mainform.BalSte p.focus(); } else { MMDiv.style.vis ibility='hidden ';
document.getEle mentById('MMDiv ').style.visibi lity='';
}
</SCRIPT>
<Form Name="myform"> <tr> <td height="7" width="177"> <div align="right">< font color="#000000" face="Comic Sans MS">Boring Type:</font></div> </td> <td height="7" width="397"><di v align="left"><f ont color=#000000 face="Comic Sans MS">
<select name=Finish onchange='able( this.form.Finis h);'> <option></option> <option>Rough </option> <option>Finis h</option> </select></font></div></td>
<DIV ID="MMDiv" style="visibili ty:hidden"> <LABEL FOR="BalStep"> <SELECT name=BalStepVal > <option></option> <option>Balance d Cutting</option> <option>Step Cutting</option> </SELECT> </DIV> </FORM> </tr>
--
Stephane Moriaux et son [moins] vieux Mac
ASM said the following on 8/30/2005 8:47 PM: pk wrote:
Here is my code, and it's not working. Please help me get through this. I've read every single tutorial and you may even see remnants of some of their variables in my code. I don't know if I'm close, but I feel that I'm getting there.
Thanks in advance for any help. I much appreciate it.
-pk
<SCRIPT>
function able(dropdown) { var myindex = dropdown.select edIndex if(myindex = 1) {
if (myIndex==1)
== is comparison
= is setting the variable.
Since it can set the var myindex to 1, it will always evaluate as true
so you never get to the else branch.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
OK, when I initially posted this, I didn't think I was all that close
to having it work. Now I swear it should be working, but it's not.
I'm posting some simplified code with comments of my thought process
(SCARY!). Tell me where I went wrong please. :) (These comments don't
truly exist in my code, I added them for insight. They're commented
Java-style since I don't write in HTML or JavaScript.)
Thanks for helping. I realize this is frustrating and you probably
just want to tell me to go read a JavaScript book.
<html>
<SCRIPT type="text/javascript"> >
function able(dropdown)
{
var myindex =
document.myform .dropdown.optio ns[document.myform .dropdown.selec tedIndex].value
// the line above put the value of my dropdown menu selection in the
variable myindex. this value will be 0, 1, or 2.
if(myindex == 1) {
document.getEle mentById('BalSt epDiv').style.v isibility="visi ble";
document.myform .BalStepVal.foc us();
// in the case that myindex is equal to 1, i would like
to set the BalStepDiv <div> to visible.
}
else {
document.getEle mentById('BalSt epDiv').style.v isibility="hidd en";
// in the case that myindex is not equal to 1, i would
like to set the BalStepDiv <div> to hidden.
}
</SCRIPT>
<body>
<Form Name="myform">
Test Select:
<select name="Finish" onchange='able( this);'>
<option></option> //selectedIndex == 0
<option>Rough </option> //selectedIndex == 1
<option>Finis h</option> //selectedIndex == 2
</select>
<div id=BalStepDiv style="visibili ty:hidden;">
// the line above sets everything between the <div> </div> tags to
hidden, until that is changed by the function above.
<select name=BalStepVal >
<option></option>
<option>Balance d Cutting</option>
<option>Step Cutting</option>
</select>
</div>
</form>
</body>
</html>
BINGO! I understand how this works now.
Instead of var myindex =
document.myform .dropdown.optio *ns[document.myform .dropdown.se*le ctedIndex].value
;
i changed it to
var myindex = document.myform .Finish.selecte dIndex;
I finally see how the naming convention works. Thanks for your help.
Randy Webb wrote: ASM said the following on 8/30/2005 8:47 PM:
if(myindex = 1) {
if (myIndex==1)
== is comparison
yeap, I didn't fix it
but others did
--
Stephane Moriaux et son [moins] vieux Mac This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rowland Hills |
last post by:
I have a table which is returning inconsistent results when I query
it!
In query analyzer:
If I do "SELECT * FROM TABLE_NAME" I get no rows returned.
If I do "SELECT COL1, COL2 FROM TABLE_NAME" I get 4 rows returned.
In Enterprise manager:
|
by: David Lawson |
last post by:
The line indicated below from my php script is very slow (about 10 seconds). I have this field
indexed so I thought that it would be much faster. Could someone tell me what might be wrong?
I'm also including the dump of the table definitions. This is a cd cataloging database.
Right now the filenames table is empty and I'm trying to populate...
|
by: kalamos |
last post by:
This statement fails
update ded_temp a
set a.balance = (select sum(b.ln_amt)
from ded_temp b
where a.cust_no = b.cust_no
and a.ded_type_cd = b.ded_type_cd
and a.chk_no = b.chk_no
group by cust_no, ded_type_cd, chk_no)
|
by: Mike R |
last post by:
Hi,
I cant figure out how to do this....
for example:
Select name from mytab order by col1
could return
Mike
|
by: serge |
last post by:
Using "SELECT * " is a bad practice even
when using a VIEW instead of a table?
I have some stored procedures that are
identical with the difference of one statement
in the WHERE clause. If I create a single View
and specify also in this View the WHERE clause
that is common in these stored procedures, I
will have the new stored procecures...
| |
by: deko |
last post by:
Can the DROP TABLE statement be used with a select or where statement?
DROP TABLE SELECT *
FROM tblTablesImported
WHERE Import_ID Not In
(SELECT FROM tblTablesInternal);
Or do I have to supply a parameter like:
DROP TABLE Sheet1
|
by: Agnes |
last post by:
My tables got over 10,000 records,
As I drag & drop the adapter into my form, it's select command must show all
the record.
question1) Now,i only want to select the data in this current period (e.g
200406), in next month (e.g200407)
How can I set this condition programmically ??
question2) Even I show the data in this current period, I must...
|
by: Peter |
last post by:
People are telling me it is bad to put
select * from <atable>
in a view. I better should list all fields of the table inside the
definition of the view.
I dont know exactly why but some say:
A select * from makes sql server does a table scan.
|
by: fniles |
last post by:
Is there a drag & drop even on tag SELECT, like maybe something like <SELECT
ondragdrop={go to function drag & drop}>) ?
Thank you
|
by: paragpdoke |
last post by:
Hello Everyone.
I'm new to XSL and couldn't get something to work.
Sample XML excerpt:
<root>
<ObjectTemplate>
<NodeType1></NodeType1>
<NodeType2></NodeType2>
</ObjectTemplate>
<Object>
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |