Hello every one i have some boxes with bbcode under each image but now I want to show up a litte box under the textarea if you click into the textbox.
My Codeidea:
$info['Show Pic<br>to a friend']='<textarea type="text" name="text" rows=2 cols=60 onclick="focus();select();copy(this.value); readonly="readonly">'.$CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/').basename($_SERVER['PHP_SELF'])."?pos=-$CURRENT_PIC_DATA[pid]".'</textarea><div align="center" id="box1" style="border: 1px solid #FF0042; visibility:hidden; background-color: #FFE7ED">My Text</div>';
So this <div align="center" id="box1" style="border: 1px solid #FF0042; visibility:hidden; background-color: #FFE7ED">My Text</div>';
is a little box and should be only show if you click on the textarea. So you have to set visibility:visible;
My Idea was to put that code behind the onclick of the textarea:
document.getElementById('box1').style.visibility = 'visible';
So the full code is:
$info['Show Pic<br>to a friend']='<textarea type="text" name="text" rows=2 cols=60 onclick="focus();select();copy(this.value); document.getElementById('box1').style.visibility = 'visible'; readonly="readonly">'.$CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/').basename($_SERVER['PHP_SELF'])."?pos=-$CURRENT_PIC_DATA[pid]".'</textarea><div align="center" id="box1" style="border: 1px solid #FF0042; visibility:hidden; background-color: #FFE7ED">My Text</div>';
But the problem is if I add this code
document.getElementById('box1').style.visibility = 'visible';
thinks like focus(); select(); copy(this.value); doesn't work.
I hope you can help me and tell me how I have to change te code.
Thx
Best Regards
Crazymodder
Is there no one who have an idea?
You're missing the ending double quotes for your onclick attribute.
I have add the " at the end but I have an error
My Code:
$info['Bild einem<br>Freund zeigen']='<textarea type="text" name="text" rows="2" cols="60" onclick="focus();select();copy(this.value);
document.getElementById('box1').style.visibility = 'visible';" readonly="readonly">'.$CONFIG["ecards_more_pic_target"] .
(substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/').basename($_SERVER['PHP_SELF'])."?pos=-$CURRENT_PIC_DATA[pid]".'</textarea><div
align="center" id="box1" style="border: 1px solid #FF0042; visibility:hidden; background-color: #FFE7ED">Code kopiert</div>';
The ErorrMessage is:
http://layertest.la.funpic.de/displayimage.php?album=random&cat=0&pos=-4#
if you change 'visible' to "visible" you get no error but than it didn't work because you must use 'visible' do you have any idea?
You need to escape the single quotes:
\'box1\'
\'visible\'
Thx Nibbler you are the best now everythink works perfectly;)