Forum Moderators: open
Hope you can help me with this. I have a guestbook script where I can add BB Code using an onclick. This works fine and this is the code I have:
function add_bb_code(gbookCode)
{
var gbookCode;
var newMessage;
var oldMessage = document.MyForm.comments.value;
newMessage = oldMessage + gbookCode;
document.MyForm.comments.value=newMessage;
document.MyForm.comments.focus();
return;
}
So, I use onclick="add_bb_code('[*b][*/b]')"
etc
That works fine.
However, if I refresh the form, ie, to preview the entry and then click to add more BB code, it doesn`t work. This error is in the javascript console:
document.MyForm.comments.focus is not a function
Any ideas?
Thanks,
dc
In fact I get this problem all the time, with virtually all javascript. I can get some code directly from Dynamic Drive, implement it and its ok. But when I refresh a page and load the same form, never works. Well, hardly ever works.
I have tried it in 4 browsers. Same in all. :(