Jump to content

Passing variables - input values - divs


ramli

Recommended Posts

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

Code:

 

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:

Code:

 

function setValue(val)
{
document.invoiceadd.incomeid.value = val;
showhide('div1');
return false;
}

 

When if opend the div here is the action i take

Code:

 

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

Link to comment
https://forums.phpfreaks.com/topic/58223-passing-variables-input-values-divs/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.