Posted by: james | September 9, 2009

Javascript + important notes..

here path is another variable and it has value of some path.

<form action=”‘+path+’new_contact.php”>
to use single quotation in js use \
here WEBPATH is constant, but you pass its value.
ex. if you want to write onclick = “return function_name(‘WEBPATH’)” and if it throws any error then, write                like this, onclick = “return function_name(\’WEBPATH\’)”….

you have more than one check box and onlyu one text box. and you want to display data into text box which are selected from check box with comma seprated… then do as following..
function value_new()
{
var temparr = new Array();
var inputs = document.getElementsByTagName(‘input’);
for(var i = 0; i<inputs.length;i++)
{
if(inputs[i].type == ‘checkbox’)
{
if(inputs[i].checked == true)
{
var val = inputs[i].value;
document.getElementById(‘mail’).value = val; // here textbox’s name and id is                                                 mail
temparr[temparr.length] = document.getElementById(‘mail’).value;
document.send.mail.value = temparr.join(‘,’); // form name send
}
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: