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

Dynamic use of <DIV>'s

25
Hi,
I'm using PHP to echo or stream out some DIV tags with content inside, by a user selection, and after a page has initially loaded.

My question is, Can I erase this dynamically created DIV container through a "close" button within the DIV... or... some other method?

thank you.
Sep 8 '06 #1
4 3067
Banfa
9,065 Expert Mod 8TB
you can't erase it but you can hide it by setting it's display style to none in javascript, this could be called from a button or link

[html]
<script type="text/javascript">
<!--

function HideElement( id )
{
var el = document.getElementById(id);

if (el)
{
el.style.display = "none";
}
}

//-->
</script>
[/html]
Sep 8 '06 #2
adriann
25
thanks for that info, which leads me to anther question.
If I hide the DIV and keep on dynamically creating a new ones, will I potentially run into memory or resource problems.

Perhaps if I use the same name or id for the DIV, then would that effectively destroy any previous instance of the DIV?

Is that logic correct?

thx
Sep 10 '06 #3
drhowarddrfine
7,435 Expert 4TB
You cannot use the same id for a div on the same page. Use class instead.
I do not see how any of this would cause memory problems.
Sep 10 '06 #4
Banfa
9,065 Expert Mod 8TB
thanks for that info, which leads me to anther question.
If I hide the DIV and keep on dynamically creating a new ones, will I potentially run into memory or resource problems.

Perhaps if I use the same name or id for the DIV, then would that effectively destroy any previous instance of the DIV?

Is that logic correct?
No.

As already said you can only use an ID once on a page. However you can re-write the contents of a div so you could re-use the one you already have.

[html]
<script type="text/javascript">
<!--
function WriteElementText( id, text )
{
var el = document.getElementById(id);

if (el)
{
el.innerHTML = text;
}
}
//-->
</script>
[/html]

If you keep on creating divs then ultimately you will get an out of memory error.
Sep 11 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Philo | last post by:
How do I select all <div> tags except those which contain a <table> tag somewhere within them? Example XML: <********************** sample input ***********************> <txtSectionBody>...
8
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a...
3
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644"...
8
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
2
Frinavale
by: Frinavale | last post by:
I've created a ASP.NET control that displays a "book" of schedules. It dynamically displays scheduling times and allows the user to page through the schedules. It also lets the user edit the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.