Link to home
Start Free TrialLog in
Avatar of runnerjp
runnerjp

asked on

trying to use an image to use as a textwrap but just refreshes page?

ok for my bbcode i want to enter images... so for this iv came up with this html/javascript  (sown below)

but the problem is when ever i click on the image.. it enters it into the textbox but then refreshes the page :S how comes??

as can be seen by the code there is a toggle area to which you can view the smilies by clicking a button or not!


function initialise() {
var element = document.getElementById('element-id');
 
if (element && element.style)
element.style.display = 'none';
}
 
function toggleDisplay(element) {
var style;
 
if (typeof element == 'string')
element = document.getElementById(element);
if (element && (style = element.style))
style.display = (style.display == 'none') ? '' : 'none';
}
 
if (!document.getElementById)
document.getElementById = function() {return null;};
 
<input type="button" value="Smilies" onclick="toggleDisplay('element-id');">
<div id="element-id" style="display: none;">
<INPUT TYPE="image" SRC="http://www.runningprofiles.com/emoticons/smiley.gif" name='smile' onclick='wrapText(document.getElementById(&#39;inputforum&#39;),&#39;:&#39;,&#39;)&#39;);'>
</div>

Open in new window

Avatar of bluV11t
bluV11t
Flag of Norway image

Could you post code for the wrapText function?
Avatar of runnerjp
runnerjp

ASKER

i did its hear


onclick='wrapText(document.getElementById(&#39;inputforum&#39;),&#39;:&#39;,&#39;)&#39;);'>

Open in new window

No that's just the call to wrapText. I need the actual function like

function wrapText(){
//some code here

}
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks worked great!!!