Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2006, 04:27 AM
Registered User
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default AJAX, javascript not executing html code


I'm working on a chat based on PHP/mySQL and AJAX. I actually got the main script from a free download but now I need to modify it. To script js isn't that hard. The problem I have is to get my javascript to translate HTML and make an execute.

Here is how it goes:

1. Page load and get results from the db in a string looking like this: $id." ---".$name." ---".replace($text)." ---".myLongDateChat($posted)." ---";

2. The --- is later taken care of in the jsfile where they work as splitters of the string.

3. Then the js does this:

//inserts the new content into the page
function insertNewContent(liName,liText,liPosted) {
insertO = document.getElementById("outputList");

oLi = document.createElement('li');

oSpan2 = document.createElement('span');
oSpan = document.createElement('span');

oSpan2.setAttribute('className','name'); //for IE's sake

oSpan.setAttribute('className','post'); //for IE's sake

oName = document.createTextNode(liName+': ');
oText = document.createTextNode(liText);
oPosted = document.createTextNode(liPosted);



insertO.insertBefore(oLi, insertO.firstChild);

Setting some class names on the different values we got from the split.

4. Now I want the oText from the split to be able to print out my emoticons but all I get is: <img src="images/smilies/biggrin.gif" width="20" height="18" alt="" border="0">

My format from [biggrin] to <img src="images/smilies/biggrin.gif" width="20" height="18" alt="" border="0"> works perfect but the js won't execute my HTML.

Can anyone help me?
Kind regards,

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a JavaScript Function from XSL IronStar XSLT 5 July 8th, 2010 07:49 PM
Executing Javascript on Page_Load kulkarnimonica ASP.NET 2.0 Professional 2 August 10th, 2007 02:12 PM
Executing asp Include file withing HTML content itHighway HTML Code Clinic 4 August 7th, 2005 01:03 PM
Executing from JavaScript C# functions see07 ASP.NET 1.x and 2.0 Application Design 1 March 1st, 2005 07:02 PM

All times are GMT -4. The time now is 10:05 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.