Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript truncating text in a string

Posted on 2007-12-06
1
Medium Priority
?
2,799 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
Sinoj Sebastian earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

618 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