View Full Version : Passing variables - input values - divs

07-03-2007, 02:11 PM
Oke i want to create draw data from a div into a input box using the following scripts:

This code hides and unhides a div

var state = 'none';

function showhide(layer_ref) {

if (state == 'block') {
state = 'none';
else {
state = 'block';
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;

And here is the code i use on a onclick action:

function setValue(val)
document.invoiceadd.incomeid.value = val;
return false;

When if opend the div here is the action i take

onclick="return setValue('1');'"

My form name is invoiceadd and the inputname is incomeid. the idea is that i set the value of incomeid in this case to 1. And exit the div frame. But i will not do neitherone so if someone could help me it well be mutch appriciated