Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2012, 05:46 PM   PM User | #1
Vernier
New Coder

 
Join Date: Dec 2011
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
Vernier is an unknown quantity at this point
Refresh a Div?

Heya!

How can I refresh a div?

I'd be having an image, and use onclick(), i'm guessing, but what code would I use?

Cheers

~ David
Vernier is offline   Reply With Quote
Old 05-15-2012, 04:18 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 362 Times in 361 Posts
sunfighter is on a distinguished road
http://www.w3schools.com/js/js_examples.asp

Go to JavaScript Events

click "Acting to the onclick event"
sunfighter is offline   Reply With Quote
Old 05-15-2012, 05:17 PM   PM User | #3
Vernier
New Coder

 
Join Date: Dec 2011
Posts: 86
Thanks: 1
Thanked 0 Times in 0 Posts
Vernier is an unknown quantity at this point
Quote:
Originally Posted by sunfighter View Post
http://www.w3schools.com/js/js_examples.asp

Go to JavaScript Events

click "Acting to the onclick event"
Cheers!

How would I refresh it?

Thanks

~ David
Vernier is offline   Reply With Quote
Old 05-16-2012, 06:20 PM   PM User | #4
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 362 Times in 361 Posts
sunfighter is on a distinguished road
I just told you. Read what i sent.

Where are you getting what is displayed in the div? Do you make it? Do you get it from outside source?

Can you post code? Can you give link to your site?
sunfighter is offline   Reply With Quote
Users who have thanked sunfighter for this post:
mbarandao (05-30-2012)
Old 05-30-2012, 05:07 PM   PM User | #5
mbarandao
Regular Coder

 
Join Date: Nov 2010
Location: Washington DC
Posts: 311
Thanks: 19
Thanked 1 Time in 1 Post
mbarandao is an unknown quantity at this point
Very helpful! I've been looking for something like this. With a little a bit of modification on the example provided on http://www.w3schools.com/js/js_examples.asp, I am able to refresh a div.

Thanks for the link!
Mossa

working code:

PHP Code:
<script type="text/javascript"> <!--using this code to refresh a div within pageadd this button to the form <button type="button" onclick="refresh()">refresh</button>-->
function 
refresh()
{
document.getElementById("toggleText3").innerHTML="<iframe id=\"accounting\" frameborder=0 scrolling=no width=100%  src=\"someplace.php\" height=\"300\" ></iframe>";
}
</script> 
the iframe is within a <div>

so on:
PHP Code:
<button type="button" onclick="refresh()"></button
the div is refreshed!

Last edited by mbarandao; 05-30-2012 at 05:12 PM.. Reason: modified
mbarandao is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:06 AM.


Advertisement
Log in to turn off these ads.