PDA

View Full Version : onclick function



insanemonkey
10-07-2007, 08:54 PM
ok I have this onclick thing for my textarea box. Just one thing,

when i try putting a image attribute to a input it gives me a wierd Url and everything is not working fine...?

<INPUT TYPE="image" VALUE="B" onClick="insertAtCaret(this.form.Copy,'B');" ID="BoldButton"

NAME="BoldButton" src="http://www.xudas.com/images/xudasaffy.gif">
I have also tried putting a onclick attribute to a image tag but it doesn't work?

<img src="http://www.xudas.com/images/xudasaffy.gif" border="0"

onClick="insertAtCaret(this.form.Copy,'B');" ID="BoldButton" NAME="BoldButton">

I don't know how to fix this, but you can see for yourself and please let me know how to fix this... thanks
Click here to see (http://www.xudas.com/test/bbcode2.html)

Thankyou

Trinithis
10-07-2007, 10:15 PM
It doesn't work in firefox.

You probably should get in the habbit of lowercasing your tags and tag attributes as well as closing empty tags (" />") for two reasions: XML and more importantly, readability.


<input type="image" value="B" onclick="insertAtCaret(this.form.Copy,'B');" id="BoldButton"
name="BoldButton" src="http://www.xudas.com/images/xudasaffy.gif" />

insanemonkey
10-07-2007, 10:24 PM
ooops, it doesn't work in IE thats what I am trying to say

Trinithis
10-07-2007, 10:53 PM
Here:



<img
onclick="insertAtCaret(document.getElementById('frmAdd1').Copy,'B');"
src="http://www.xudas.com/images/xudasaffy.gif"
alt="xudasaffy.gif"
/>


Oh, and by the way, document.all.FinishedText is null or is not an object.

insanemonkey
10-08-2007, 04:29 AM
Thankyou for your help, im going to test it,... yay..