473,396 Members | 1,846 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,396 software developers and data experts.

Dynamically changing the HTML in a page.

Hello,

Now I think that there is a simple answer to my problem, but I don't
know what it is and I can't work out what I should be searching for on
the internet to read up some more about it. Here is my problem:

I have a webpage that shows a graph. The graph is a streamed image
from another webpage. This works perfectly, see code below, I have
just written some HTML to display the graph.

<P align=center><IMG style="Z-INDEX: 105; LEFT: 9px; WIDTH: 950px;
POSITION: absolute; TOP: 217px; HEIGHT: 150px" height=150
alt=Temperature! src="draw_Graph_1.aspx?Channel=29&amp;Hours=168"
width=950 border=0 ></P>

However, what I would like to do is to change the "Channel=29" to
something that the user has selected, so that they can change the
graph. Something like "Channel=iNewChannel", but I just don't know
how to go about this.

Thanks in adavance,
Smele.
Nov 18 '05 #1
3 1200
Use an image control out of the toolbox and build the src property
dynamically.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"SGA Smele" <si*********@hotmail.com> wrote in message
news:23*************************@posting.google.co m...
Hello,

Now I think that there is a simple answer to my problem, but I don't
know what it is and I can't work out what I should be searching for on
the internet to read up some more about it. Here is my problem:

I have a webpage that shows a graph. The graph is a streamed image
from another webpage. This works perfectly, see code below, I have
just written some HTML to display the graph.

<P align=center><IMG style="Z-INDEX: 105; LEFT: 9px; WIDTH: 950px;
POSITION: absolute; TOP: 217px; HEIGHT: 150px" height=150
alt=Temperature! src="draw_Graph_1.aspx?Channel=29&amp;Hours=168"
width=950 border=0 ></P>

However, what I would like to do is to change the "Channel=29" to
something that the user has selected, so that they can change the
graph. Something like "Channel=iNewChannel", but I just don't know
how to go about this.

Thanks in adavance,
Smele.

Nov 18 '05 #2
You can do this using javascript. Give your image an ID, so you can access
it using the DOM, and then dynamically change the source:

Add a client side function to your page:

<script language="javascript">
<!--
function changeChannel (newChannel)
{
// Reference to the image
var img = document.all["graphImage"];

// Get the current source
var oldsrc = img.src;

// Replace the channel
var newsrc = oldsrc.replace(/Channel=[\d]+/, "Channel=" +
newChannel);

// Update the source
img.src = newsrc;
}
//-->
</script>

Create your image, with an ID. Additional attributes have been omitted as
they are not relevant to this example:

<img id="graphImage" src="draw_Graph_1.aspx?Channel=29&amp;Hours=168">

Now, you can simple change the source, by calling the changeChannel function
with the new channel ID. Eg.

<input type="button" value="Channel 15" onClick="changeChannel(15)">

Hope this helps,

Mun


"SGA Smele" <si*********@hotmail.com> wrote in message
news:23*************************@posting.google.co m...
Hello,

Now I think that there is a simple answer to my problem, but I don't
know what it is and I can't work out what I should be searching for on
the internet to read up some more about it. Here is my problem:

I have a webpage that shows a graph. The graph is a streamed image
from another webpage. This works perfectly, see code below, I have
just written some HTML to display the graph.

<P align=center><IMG style="Z-INDEX: 105; LEFT: 9px; WIDTH: 950px;
POSITION: absolute; TOP: 217px; HEIGHT: 150px" height=150
alt=Temperature! src="draw_Graph_1.aspx?Channel=29&amp;Hours=168"
width=950 border=0 ></P>

However, what I would like to do is to change the "Channel=29" to
something that the user has selected, so that they can change the
graph. Something like "Channel=iNewChannel", but I just don't know
how to go about this.

Thanks in adavance,
Smele.

Nov 18 '05 #3
Thanks very much, I knew there would be a simple solution...
"Munsifali Rashid" <mun.news@#RemoveToReply#cordlessmouse.co.uk> wrote in message news:<#O**************@TK2MSFTNGP11.phx.gbl>...
You can do this using javascript. Give your image an ID, so you can access
it using the DOM, and then dynamically change the source:

Add a client side function to your page:

<script language="javascript">
<!--
function changeChannel (newChannel)
{
// Reference to the image
var img = document.all["graphImage"];

// Get the current source
var oldsrc = img.src;

// Replace the channel
var newsrc = oldsrc.replace(/Channel=[\d]+/, "Channel=" +
newChannel);

// Update the source
img.src = newsrc;
}
//-->
</script>

Create your image, with an ID. Additional attributes have been omitted as
they are not relevant to this example:

<img id="graphImage" src="draw_Graph_1.aspx?Channel=29&amp;Hours=168">

Now, you can simple change the source, by calling the changeChannel function
with the new channel ID. Eg.

<input type="button" value="Channel 15" onClick="changeChannel(15)">

Hope this helps,

Mun


"SGA Smele" <si*********@hotmail.com> wrote in message
news:23*************************@posting.google.co m...
Hello,

Now I think that there is a simple answer to my problem, but I don't
know what it is and I can't work out what I should be searching for on
the internet to read up some more about it. Here is my problem:

I have a webpage that shows a graph. The graph is a streamed image
from another webpage. This works perfectly, see code below, I have
just written some HTML to display the graph.

<P align=center><IMG style="Z-INDEX: 105; LEFT: 9px; WIDTH: 950px;
POSITION: absolute; TOP: 217px; HEIGHT: 150px" height=150
alt=Temperature! src="draw_Graph_1.aspx?Channel=29&amp;Hours=168"
width=950 border=0 ></P>

However, what I would like to do is to change the "Channel=29" to
something that the user has selected, so that they can change the
graph. Something like "Channel=iNewChannel", but I just don't know
how to go about this.

Thanks in adavance,
Smele.

Nov 18 '05 #4

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

Similar topics

2
by: wjbell | last post by:
I have a piece of javascript I need to modify. Right now it changes a stylesheet in the document between style.css and no_indent.css. These are in the head of my document: <link rel=stylesheet...
1
by: C A Upsdell | last post by:
I have a site where I am setting a style dynamically, using the JS statement: obj.style.backgroundImage = 'url(img/bak_page.jpg)'; where 'obj' is either document.getElementById(id), or...
2
by: DartmanX | last post by:
I doubt this is possible, but I want to ask, just in case it is. I have a project going using Google Maps. This project spits out an HTML page template for people to post to their website and...
6
by: Test Message | last post by:
I need to dynamically add an html control to a web form. What I have, thus far, adds the control to the page, but only places it after the closing "</html>" tag. ...
2
by: ezmiller | last post by:
Hi, I have some code (which I will paste in below) that writes out some HTML dynamically using the W3C DOM...the last part of the code write out a simple table. MY problem is that the table is...
2
by: gralexp | last post by:
Hi Guys. I have a problem, and for some reason I have not been able to find an answer on the net. In a nutshell, I have some codes on my page, which I want to change to an appropriate string...
1
by: adamredwards | last post by:
I have a page with some form elements that are dynamically generated. They are inserted into the dom by first cloning a node, changing the values like name, and then inserted with insertBefore(). ...
2
by: tshad | last post by:
Is there a way to dynamically add in User Controls where I would get the name from a session variable: If I have the following code:...
4
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.