473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Can this be done in JavaScript ?

Basically I have a situation where I need to update changes occuring
in one Text field of a table into another text field located in
another table. In addition both the tables are located in different
frames of a HTML page. So my question is can such an update be done ?
Is it necessary that the tables be located in the same frame for the
update to work ? Any pointers would be appreciated ?

Thanks,
-P.
Jul 23 '05 #1
3 1539
In article <7a**************************@posting.google.com >,
nm******@yahoo.com enlightened us with...
Basically I have a situation where I need to update changes occuring
in one Text field of a table into another text field located in
another table. In addition both the tables are located in different
frames of a HTML page. So my question is can such an update be done ?
Is it necessary that the tables be located in the same frame for the
update to work ? Any pointers would be appreciated ?

Thanks,
-P.


It can be done IF:
All browsers using it are DOM compliant.
All browsers using it have javascript enabled.
All relevant frames come from the same domain and use the same protocol (http
or https, but both the same).

--
--
~kaeli~
He had a photographic memory that was never developed.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Thanks Kaeli.

-P.

kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP************************@nntp.lucent.com>. ..
In article <7a**************************@posting.google.com >,
nm******@yahoo.com enlightened us with...
Basically I have a situation where I need to update changes occuring
in one Text field of a table into another text field located in
another table. In addition both the tables are located in different
frames of a HTML page. So my question is can such an update be done ?
Is it necessary that the tables be located in the same frame for the
update to work ? Any pointers would be appreciated ?

Thanks,
-P.


It can be done IF:
All browsers using it are DOM compliant.
All browsers using it have javascript enabled.
All relevant frames come from the same domain and use the same protocol (http
or https, but both the same).

--

Jul 23 '05 #3
nm******@yahoo.com (pentium77) wrote in message news:<7a**************************@posting.google. com>...
Basically I have a situation where I need to update changes occuring
in one Text field of a table into another text field located in
another table.
How does the text field change in the first table?

If you are already changing text in the first frame, all you have to
do is find the node in the table in the second frame and you can use
the same code to change the text in the second frame.
In addition both the tables are located in different
frames of a HTML page. So my question is can such an update be done ?


I'll change some text in a table in another frame.

The tag id needs to be unique. Make certain that you do not have name
conflicts in IE.

With MacOS 10.2.6, I tested these in IE 5.2, Safari 1.0, and Netscape
7.2.

Robert
frames.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frames Layout</title>
</head>
<frameset rows="45%,55%" >
<frame src="frame1.html"
id="myframe1"
name="nameframe1"
scrolling=yes>
<frame src="frame2.html"
id="myframe2"
name="nameframe2"
scrolling=yes>
</frameset>
</html>

frame1.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>insert some text</title>
</head>
<body>
<p>Insert or change some text.
<br>
Don't forget to see what happens when you
press the button more than once.</p>
<form name="myForm">
<input type="text" name="total" size="20">
<br><br>
<input type="button"
name="activate"
value="change the text"
onclick="top.frames['nameframe2'].changeText('insert',
document.forms['myForm'].elements['total']);">
<br>
</form>
</body>
</html>

frame2.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>frame 2</title>

<script type="text/javascript">
function changeText(spanId,text)
{
var node;
/* Find the span node. */
if (document.getElementById)
{
node = document.getElementById(spanId);
}
else if (document.all)
{
node = document.all[spanId];
}
else
{
alert("Constructs document.getElementByID " +
"and document.all are not available in this browser. " +
"You need to use a newer browser.");
return;
}

if (!node)
{
alert("You need to create a span tag with " +
"the id of " + spanId + ".");
return;
}

/* Insert the text. */

if (typeof node.innerHTML == "string")
{
/* Make innerHTML act like the simple text insert. */
node.innerHTML = text.value.replace(
/&/g, "&amp;").replace(
/</g, "&lt;").replace(
/>/g, "&gt;").replace(
/ /g, "&nbsp;");
}
else if (node.appendChild &&
document.createTextNode)
{
/* Since this is plan text, prevent multiple
blanks from being compressed into one. */
var theData = text.value.replace(/ /g, "\xA0");

/* If a node already exists, assume we
created it on a prior click by the user. */
var nextNode = node.firstChild;
if(nextNode)
{
/* Yes, replace the text. */
nextNode.data = theData;
}
else
{
/* No, Insert the new node. */
node.appendChild(
document.createTextNode(theData));
}
}
else
{
alert("Functions to insert text are not available. " +
"You need to use a newer browser.");
return;
}
}

</script>
</head>
<body>
<p>Text in this frame will be changed from frame 1.</p>
<table border="2">
<tr>
<td>
<p>Text in the cell below will be changed.</p>
</td>
</tr>
<tr>
<td>
<p>Change this "<span id='insert'></span>".</p>
</td>
</tr>
</table>
</body>
</html>
Jul 23 '05 #4

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

Similar topics

1
by: richard green | last post by:
I have a huge text file which contains a list of all possible services that can be offered to the users. Let's say it looks like <services> <service>srv1</service> <service>srv2</service>...
2
by: Simon Wigzell | last post by:
I'm on a different computer running win 95 with IE 5 my website on a new dedicated server and I'm getting "Done, but with errors on page" appearing in the browser status area which I have never...
5
by: Jay | last post by:
Difficult to explain but.... I have a form. Inside the form is a table (2 columns). 1st column has text. Click on the text and a hidden div appears in the 2nd column and contains a textarea....
1
by: Empire City | last post by:
Hover Over Menu - Can this be done with C# or is it JavaScript? If JavaScript what would be the closest way to do something like this in C#, such as a drop down list box? If JavaScript is best does...
2
by: maya | last post by:
http://news.yahoo.com/news?tmpl=index2&cid=703 down the page, under "More Stories", there's a section with two interchangeable divs which slide back and forth into view.. how is this done? I...
3
by: maya | last post by:
http://www.msnbc.msn.com/id/16673873/site/newsweek/ pls scroll down, on the left, near the middle, there is a select object above which it says "Newsweek Business Directory".. how do they get...
12
by: Max | last post by:
Hi All, I need to check if attachEvent was done to an element. The problem is that attachEvent does not save this information anywhere. Is there any way to do this??? Thanks, Max
11
by: test | last post by:
Hi, I'm very new to Javascript so maybe my question could be stupid. I'm playing with microcontrollers and a TCP/IP component. This means that I can control electronics via TCP/IP, UDP and so on....
2
by: labmonkey111 | last post by:
I have a form that takes several seconds to run the javascript needed to prepare the form for PHP (selecting all items in a Select Multiple). Since it takes so long, I want to disable the Submit...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.