Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drill down / store variable in form field

Status
Not open for further replies.

kjohnson530

IS-IT--Management
Mar 26, 2006
28
0
0
US
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:

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"/>&nbsp;Whole foods</a> 
        <div id="box1"> 
//!-->
 
Could you post an example of the HTML code you have that includes example invoice item list information? What you are asking is very doable, however, it will depend on how the HTML is structured, as well as what HTML you are using.

Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top