coldkill Posted March 28, 2006 Share Posted March 28, 2006 I'm trying to make a phpBB editor type editor. I've got everything working except a script which is supposed to change the value of a text box depending on what button the user hovered over. Any help much apreciated ColdJS Script:[code]function tagHelp(name, usage){ eval("window.document.form."+name+".value = 'Usage: "+usage;+"'"); }[/code]HTML:[code] <tr> <td> </td> <td class="login"><input type="button" value="Bold" name="bold" onmouseover="javascript:tagHelp(\'use\', \'[b]Bold Text[/b]\');" onclick="javascript:tag(\'b\', \'[b]\', \'Bold*\', \'[/b]\', \'Bold\', \'bold\');" class="submitbutton" /> <input type="button" value="Paragraph" name="par" onmouseover="javascript:tagHelp(\'use\', \'Text [p] More text\');" onclick="javascript:tag(\'b\', \'[p]\', \'Paragraph\', \'[p]\', \'Paragraph\', \'par\');" class="submitbutton" /> <input type="button" value="URL" name="url" onmouseover="javascript:tagHelp(\'use\', \'[url=http://www.url.com]URL Text[/url] OR [url]http://www.url.com[/url]\');" onclick="javascript:tag(\'b\', \'[url]\', \'URL*\', \'[/url]\', \'URL\', \'url\');" class="submitbutton" /> <input type="button" value="Center" name="cen" onmouseover="javascript:tagHelp(\'use\', \'[center]Centered Text[/center]\');" onclick="javascript:tag(\'b\', \'[center]\', \'Center*\', \'[/center]\', \'Center\', \'cen\');" class="submitbutton"/> <input type="button" value="Italic" name="it" onmouseover="javascript:tagHelp(\'use\', \'[i]Italic Text[/i]\');" onclick="javascript:tag(\'b\', \'[i]\', \'Italic*\', \'[/i]\', \'Italic\', \'it\');" class="submitbutton" /> <input type="button" value="Underline" name="und" onmouseover="javascript:tagHelp(\'use\', \'[u]Underlined Text[/u]\');" onclick="javascript:tag(\'b\', \'[u]\', \'Underline*\', \'[/u]\', \'Underline\', \'und\');" class="submitbutton" /> <input type="button" value="Quote" name="qut" onmouseover="javascript:tagHelp(\'use\', \'[quote=Name]Quoted Text[/quote] OR [quote]Quoted Text[/quote]\');" onclick="javascript:tag(\'b\', \'[quote]\', \'Quote*\', \'[/quote]\', \'Quote\', \'qut\');" class="submitbutton" /> <input type="button" value="Image" name="img" onmouseover="javascript:tagHelp(\'use\', \'[image]http://www.url.com/image.jpg[/image]\');" onclick="javascript:tag(\'b\', \'[image]\', \'Image*\', \'[/image]\', \'Image\', \'img\');" class="submitbutton" /> </td> </tr>[/code]The HTML is in a PHP echo. Quote Link to comment Share on other sites More sharing options...
Zane Posted March 28, 2006 Share Posted March 28, 2006 if you're wanting to perform it when on hoveryou should use onMouseOver instead of MouseOutand also on your script[code]function tagHelp(name, usage){ eval("window.document.form."+name+".value = Usage: usage;"); }[/code]usage should be outside the quotes the same as namelike so[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]function tagHelp(name, usage){ eval("window.document.form."+name+".value = Usage:[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--][b]"+usage+"[/b][!--colorc--][/span][!--/colorc--];"); }[/quote]and if I'm not mistaken you should have to put single quotes around the new value[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]function tagHelp(name, usage){ eval("window.document.form."+name+".value = [!--coloro:#3366FF--][span style=\"color:#3366FF\"][!--/coloro--]'Usage:"+usage+"'[!--colorc--][/span][!--/colorc--];"); }[/quote] Quote Link to comment Share on other sites More sharing options...
coldkill Posted March 28, 2006 Author Share Posted March 28, 2006 Yes i changed it to onmouseout instead of over to see if it would make a difference. Just forgot to update it :S. Changed it to what you suggested and it still didn't work. Updated the code above.::EDIT::NVM typo.Thanks v. much.[b]::CLOSED::[/b] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.