嗨那裏我有60個圖像標籤..點擊每個標籤顯示不同的文本在一個文本框.. soo我想知道而不是輸入javascript
代碼在每個圖像標籤有沒有什麼辦法使用一個javascript
函數...並將該函數放入每個圖片標籤的onclick=""
事件中。希望我讓自己變得清晰...任何幫助將被讚賞......在此先感謝.. :)哦和下面是所有60個圖像標籤...縮短几個元素的onclick代碼 - javascript
<img src='smileys/birthday.gif' style="height:22px;margin:3px;" />
<img src='smileys/blue.gif' style="height:22px;margin:3px;" />
<img src='smileys/blush.gif' style="height:22px;margin:3px;" />
<img src='smileys/boo.gif' style="height:22px;margin:3px;" />
<img src='smileys/book.gif' style="height:22px;margin:3px;" />
<img src='smileys/busted.gif' style="height:22px;margin:3px;" />
<img src='smileys/goodnight.gif' style="height:22px;margin:3px;" />
<img src='smileys/newhere.gif' style="height:22px;margin:3px;" />
<img src='smileys/nicethread.gif' style="height:22px;margin:3px;" />
<img src='smileys/nospamhere.gif' style="height:22px;margin:3px;" />
<img src='smileys/offtopic.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-ashamed004.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-confused001.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-confused013.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-dance012.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-dance019.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-excited001.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-fart004.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-fart005.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-finger005.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-gen013.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-gen041.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-gen055.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-gen073.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-happy011.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-happy020.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-happy120.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug001.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug004.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug005.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug006.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug014.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-hug015.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-laughing001.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-laughing002.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love001.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love007.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love010.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love018.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love019.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love022.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love025.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love027.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-love028.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-taunt002.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-taunt014.gif' style="height:22px;margin:3px;" />
<img src='smileys/welcome.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-sad008.gif' style="height:22px;margin:3px;" />
<img src='smileys/wtf.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-confused002.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-angelic002.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-cool02.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-devil03.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-happy112.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-happy119.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-sad056.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-sad007.gif' style="height:22px;margin:3px;" />
<img src='smileys/smiley-confused005.gif' style="height:22px;margin:3px;" />
<img src='smileys/cheekkiss.gif' style="height:22px;margin:3px;" />
<img src='smileys/toj.png' style="height:22px;margin:3px;" />
您已標記'jquery',但我看不到jquery。請嘗試一下,而不是簡單地要求某人爲您編寫代碼。 – MonkeyZeus
對不起..但我不知道從哪裏開始... –
http://www.jquery.com http://learn.jquery.com/about-jquery/how-jquery-works/ http: //www.w3schools.com/jquery/ https://www.google.com/search?q=jquery+onclick&oq=jquery+onclick&aqs=chrome..69i57j0j69i60l2j0l2.3002j0j8&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8 – MonkeyZeus