Solved

Javascript truncating text in a string

Posted on 2007-12-06
1
2,790 Views
Last Modified: 2012-06-27
I'm returning data that was escaped, I can see the escaped data with the first alert (ie. DESIGN%20DOCUMENTS). I then assign the unescape data to variable desc. The next alert I see the unescape data with spaces (ie DESIGN DOCUMENTS). All is well at this point. Next I build a variable str with HTML using the variable desc to place the value in a text box, this is where it gets truncated, all that gets loaded into the text box is DESIGN not DESIGN DOCUMENTS. Any suggestions. Thanks.
alert(timeq.desc[0]);
     var desc = unescape(timeq.desc[0]);alert(desc);
     str+='<TD width="10%"><input class="sminputbox" style="text-align:right" OnKeyup="chkdols(this);" OnFocus="select();" name="prehrs1" value=' + timeq.hours[0] + ' size="4" maxlength="4"><\/TD>';
     str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value=' + desc + ' size="45" maxlength="150"><\/TD>';
     str+='<TD width="20%" id="preact1">' + timeq.workact[0] + '<\/TD>';
     str+='<TD width="20%" align="center"><img name="saves" id="1" valign="bottom" src="/Graphics/smpost_button.jpg" onClick="SavePre(this);" title="Click to save this transaction for current post date."></TD>';
     str+='<TD width="5%"><\/TD><\/TR><TR>';
document.getElementById("previousspan").innerHTML = str

Open in new window

0
Comment
Question by:headjava
1 Comment
 
LVL 12

Accepted Solution

by:
Sinoj Sebastian earned 125 total points
ID: 20421334
use

str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value="' + desc + '" size="45" maxlength="150"><\/TD>';
     
alert(timeq.desc[0]);
     var desc = unescape(timeq.desc[0]);alert(desc);
     str+='<TD width="10%"><input class="sminputbox" style="text-align:right" OnKeyup="chkdols(this);" OnFocus="select();" name="prehrs1" value=' + timeq.hours[0] + ' size="4" maxlength="4"><\/TD>';
     str+='<TD width="30%"><input class="sminputbox" type="text" name="predesc1" value="' + desc + '" size="45" maxlength="150"><\/TD>';
     str+='<TD width="20%" id="preact1">' + timeq.workact[0] + '<\/TD>';
     str+='<TD width="20%" align="center"><img name="saves" id="1" valign="bottom" src="/Graphics/smpost_button.jpg" onClick="SavePre(this);" title="Click to save this transaction for current post date."></TD>';
     str+='<TD width="5%"><\/TD><\/TR><TR>';
document.getElementById("previousspan").innerHTML = str

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Not allowed to load local recource. 4 35
AJAX ModalPopupExtender will Not Hide in Asp.net 1 8
Html value of radio 14 31
How to control cache of some js files ? 7 41
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question