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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.