Ok, so I built this site. One of the pages is the news feed www.wenotelling.x10.mx/news/ The news page has a built-in news page in which the actual update takes place. All this is very good and good, and this web page seems to work. However, I had 2 questions.
- The feed does not seem to have been updated when the pages load, but it loads when the page is refreshed.
- I wanted to add emoticons.
So, I wrote some JScript to fix both of these problems at a time. Since the news feed is updated using an HTML page, and I did not want to look at the emoticon URL each time, I came up with the following code: http://www.wenotelling.x10.mx/news/smilescript.js
$(document).ready(function() { alert("Called"); document.getElementByClass('happy').innerHTML = '<img src="smileys/happy.gif"></img>'; document.getElementByClass('star').innerHTML = '<img src="smileys/star.gif"></img>'; document.getElementByClass('dead').innerHTML = '<img src="smileys/dead.gif"></img>'; document.getElementByClass('yawn').innerHTML = '<img src="smileys/yawn.gif"></img>'; document.getElementByClass('snub').innerHTML = '<img src="smileys/snub.gif"></img>'; document.getElementByClass('relax').innerHTML = '<img src="smileys/relax.gif"></img>'; document.getElementByClass('devil').innerHTML = '<img src="smileys/devil.gif"></img>'; document.getElementByClass('cool').innerHTML = '<img src="smileys/cool.gif"></img>'; document.getElementByClass('wink').innerHTML = '<img src="smileys/wink.gif"></img>'; document.getElementByClass('shock').innerHTML = '<img src="smileys/shock.gif"></img>'; document.getElementByClass('bigsmile').innerHTML = '<img src="smileys/bigsmile.gif"></img>'; document.getElementByClass('confused').innerHTML = '<img src="smileys/confused.gif"></img>'; document.getElementByClass('sad').innerHTML = '<img src="smileys/sad.gif"></img>'; document.getElementByClass('angry').innerHTML = '<img src="smileys/angry.gif"></img>'; document.getElementByClass('clown').innerHTML = '<img src="smileys/clown.gif"></img>'; document.getElementByClass('blush').innerHTML = '<img src="smileys/blush.gif"></img>'; if(location.hash !="#"); { location = "#"; location.reload(true); } alert("A-OK"); });
So, when editing, we can just put <smiley class="happy"></smiley> . I know that the emoticon is not a real tag, but I did not think that this would make a difference, because I had seen "faketags" before. I tried changing the emoticon tag to <div class="happy"></div> , but that didn't work either. At the end of the script, I put the update function.
In any case, the script did not work. This is called, but does not work. So I ran Firebug. Firebug gave the following message:
SyntaxError: missing ) after argument list [Break On This Error] (22 out of range 21)
Then I looked at the script, and everything, everything) seems to be there. Not only this, but the emoticons before line 22 also do not work.
Anyway. Any ideas why: 1) Emoticons do not appear? 2) the script is not fully executed?