Click to See Complete Forum and Search --> : trivial question


witold
05-08-2003, 05:21 PM
hi,

i'm sure my question is rather simple to all JS gurus, but i can't help it. in a "for" loop borrowed from a ready-made script i need to convert:

colum_name.innerText = c;

into a link e.g.

colum_name.innerText = ("<a href='aa.php'>'+c+'</a>");

my efforts are fruitless, of course. either nothing shows up or the whole piece of code gets printed out on the screen.
i know how to do this in PHP and ASP, but JS is my weak point.
can anyone give me a hint?

witold

witold
05-08-2003, 05:33 PM
that's a good point.
now i know i was right asking instead of spending another hour searching the net in vain.

thanks dave.

witold
05-08-2003, 07:14 PM
sorry for bothering you again.

this time i'd like to transfer a selected value within the same form.

i've tried this:

var m = document.getElementById("month");
then

colum_name.innerHTML = ('<a href="aa.php?m='+m+'&d='+c+'">'+c+'</a>');

but it didn't work

so i used

colum_name.innerHTML = ('<a href="aa.php?m='+document.options.month.value+'&d='+c+'">'+c+'</a>');

but it didn't work either.

why is it so difficult?

witold

pyro
05-08-2003, 08:53 PM
What exactly are you trying to do? All var m = document.getElementById("month"); is returning is the element with an id of month. What do you want it to return?

witold
05-09-2003, 04:10 AM
sorry, but none of them works.
here is a piece of code where the 'month value' is stored

document.write("<select name=month onchange=change_month(this.options.selectedIndex)>");
for(i=0;i<month_array.length;i++)
{
if (now.getMonth() != i)
{document.write ("<option value="+i+">"+month_array[i]);}
else
{document.write ("<option value="+i+" selected>"+month_array[i]);}

}
document.write("</select>");

now i need to transfer the currently selected value to this line

colum_name.innerHTML = ('<a href="aa.php?y='+show_date.getYear()+'&m='+CurrentMonthValue+'&d='+c+'">'+c+'</a>');


witold