kjohnson530
IS-IT--Management
I am a newbie to java scripting so I'm hoping someone can help me out.
I am working on a drill down page. As it stands right now I have java script that hides and unhides div layer on a Purchase Order system. which appears like this:
Vendor
Invoice#
Line Items
The vendor list is hardcoded. The Invoice# list is generated from a recordset from a SQL DB. I would like to take each invoice number and make it a hyperlink that then drills down and displays each line item associated with that particular invoice. The problem as I see it is that I cannot have a pre-exisiting recordset establish for each individual Invoice.
So Im interested in creating a script that will perform two functions:
1.set a hidden field on the page with the invoice number that has been displayed and clicked upon.
2.Also display div afterward.
I have no java skill whatsoever so any help would be greatly appreciated.
Here is the code I've trying to work with:
I am working on a drill down page. As it stands right now I have java script that hides and unhides div layer on a Purchase Order system. which appears like this:
Vendor
Invoice#
Line Items
The vendor list is hardcoded. The Invoice# list is generated from a recordset from a SQL DB. I would like to take each invoice number and make it a hyperlink that then drills down and displays each line item associated with that particular invoice. The problem as I see it is that I cannot have a pre-exisiting recordset establish for each individual Invoice.
So Im interested in creating a script that will perform two functions:
1.set a hidden field on the page with the invoice number that has been displayed and clicked upon.
2.Also display div afterward.
I have no java skill whatsoever so any help would be greatly appreciated.
Here is the code I've trying to work with:
Code:
function showOrHide(eId, thisImg, state) {
if (e = document.getElementById(eId)) {
if (state == null) {
state = e.style.display == 'none';
e.style.display = (state ? '' : 'none');
}
//...except for this, probably a better way of doing this, but it works at any rate...
if (state == true){
document.getElementById(thisImg).src="minus.gif";
}
if (state == false){
document.getElementById(thisImg).src="plus.gif";
}
}
}
//function to hide all "boxes"
function hideAll(){
document.getElementById('box1').style.display = 'none';
document.getElementById('box2').style.display = 'none';
document.getElementById('box3').style.display = 'none';
document.getElementById('box4').style.display =
}
<td width="58%"><div id="menu"><a href="javascript:;" onClick="showOrHide('box1', 'img1')" class="itemLink"><img src="plus.gif" name="img1" width="10" height="10" border="0" id="img1"/> Whole foods</a>
<div id="box1">
//!-->