473,499 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

string to object

Lee
Hi, how would I change this to an object that I can add onto a table?
And how would I add it to the table?

<tr>
<td>{var1}</td>
<td>{var2}</td>

<td>
<table>
<tr>
<td>Name: {name3}</td>
<td>Age: {age3}</td>
</tr>
</table>
</td>

</tr>

I was talking about it in this discussion but the topic got cold
somehow.
http://groups-beta.google.com/group/...8d4af98135fa07

Actually, this is the actual string, but the top one is easier to look
at.

<tr id='schedule_row{hoursId}' class='schedule_row'>
<td class='icon_schedule {dayType}' id='icons{hoursId}'><a
href='javascript:popUpWindow("editschedule.php?emp loyee={employeeUsername}&timestamp={timestamp}&hou rsId={hoursId}",0,0,600,600);'><img
src='images/pen.gif' class='icon' style='height:10px;' /></a><a
href='javascript:deleteHoursRow("{hoursId}");'
style='text-decoration:none'>X</a></td>

<td class='name {dayType}' id='name{hoursId}'
onclick="makeCalendarInputField(this,'{hoursId}',' name');"
onkeyup="blurThis(this,event);">{name}</td><td class='time'
id='hours{hoursId}'>

<table border=0 id='start{hoursId}' onMouseOver='showControls(this);'
onMouseOut='hideControls(this);' class='{dayType}' cellspacing=0
cellpadding=0>
<tr>

<td valign='top' id='start0_{hoursId}' class='start0'
onclick='makeCalendarInputField(this,"{hoursId}"," start");'
onkeyup='blurThis(this,event);'>{start}</td>

<td>
<table id='start{hoursId}_controls' class='hoursControls'
cellspacing=0 cellpadding=0>

<tr>
<td><a href='javascript:void(0);'
onClick="ajaxChangeHour('1','{hoursId}','start');" ><img
src='images/up.gif' class='icon controlsIcon' /></a></td>
</tr>
<tr>
<td><a href='javascript:void(0);'
onClick="ajaxChangeHour('-1','{hoursId}','start');"><img
src='images/down.gif' class='icon controlsIcon' /></a></td>
</tr>
</table>
</td>
</tr>

</table>
</td>
<td class='{dayType}'- </td>
<td>
<table id='end{hoursId}' onMouseOver='showControls(this);'
onMouseOut='hideControls(this);' class='{dayType}' cellspacing=0
cellpadding=0>
<tr>
<td valign='top' id='end0_{hoursId}' class='end0'
onclick='makeCalendarInputField(this,"{hoursId}"," end");'
onkeyup='blurThis(this,event);'>{end}</td>

<td>
<table id='end{hoursId}_controls' class='hoursControls'
cellspacing=0 cellpadding=0>
<tr>
<td><a href='javascript:void(0);'
onClick="ajaxChangeHour('1','{hoursId}','end');">< img
src='images/up.gif' class='icon controlsIcon' /></a></td>
</tr>
<tr>
<td><a href='javascript:void(0);'
onClick="ajaxChangeHour('-1','{hoursId}','end');"><img
src='images/down.gif' class='icon controlsIcon' /></a></td>
</tr>
</table>

</td>
</tr>
</table>
</td>
</tr>

Nov 24 '06 #1
3 1580
VK

Lee wrote:
Hi, how would I change this to an object that I can add onto a table?
And how would I add it to the table?

<tr>
<td>{var1}</td>
<td>{var2}</td>

<td>
<table>
<tr>
<td>Name: {name3}</td>
<td>Age: {age3}</td>
</tr>
</table>
</td>

</tr>

I was talking about it in this discussion but the topic got cold
somehow.
<http://groups-beta.google.com/group/comp.lang.javascript/browse_thread/thread/d28d4af98135fa07>
What's wrong with the advises you've got in the previous thread? IMHO
they provided enough of possible directions to change your solution.
The background is that you cannot do exactly what you want in the exact
way you want: Table DOM handling requires a strict hierarchy: you
create table; you create tbody; you create TR; you fill TR with TD
elements; you add TR to tbody; you repeat for each row. You cannot just
drop random HTML blocks into table here and there: it will not work or
it will crash somewhen later. Respectively you cannot just take a
source code for a TR (with all TD's code in it) and somehow transform
it into into TR object in one move. If you insist on the current
approach then you need a throughout source parsing: when it would be
more easy and effective to use XSLT (with your HTML template kept as a
well-formed XML document).

Nov 24 '06 #2
Lee
I was hoping that someone would have a creative idea on how to use the
given template. I know that I have to use the table functions instead
of inserting html. I just want to know if there is a creative way to
do this.

Nov 26 '06 #3
VK

Lee wrote:
I was hoping that someone would have a creative idea on how to use the
given template. I know that I have to use the table functions instead
of inserting html. I just want to know if there is a creative way to
do this.
Well, a creative (plus standard and effective) way could be by using
the HTML source as XSL template, actual data as XML source and so make
an XSLT transformer producing (server-side or client-side by your
choice) a ready to use HTML page. Besides other things it also
eliminates 100% script-dependency of the front display.

Nov 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3665
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
8
2777
by: Grant Wagner | last post by:
I'm a bit confused by String() (typeof 'string') vs new String() (typeof 'object'). When you need to access a method or property of a -String-, what type is JavaScript expecting (or rather, what...
12
49225
by: Joe Fallon | last post by:
I would like to know the syntax to check that an Object is a String. If it was a number test I might use IsNumeric. But there is no function: IsString (is there?) -- Joe Fallon
53
4014
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
6
2191
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time...
34
2615
by: Larry Hastings | last post by:
This is such a long posting that I've broken it out into sections. Note that while developing this patch I discovered a Subtle Bug in CPython, which I have discussed in its own section below. ...
1
5211
by: macupryk | last post by:
+ ex {"The name \"CHARACTER\" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted."}...
26
2731
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
1
6038
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
21
55569
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.