Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Button which allows users to refresh page
Old 05-13-2010, 05:54 AM Button which allows users to refresh page
magicvw's Avatar
Extreme Talker

Latest Blog Post:
Ye Olde Christmas Music
Posts: 235
Name: Vicky
Location: Brit in Bulgaria
Trades: 1
I'm using the following:

Code:
<form><input type=button value="Clear Answers" onClick="history.go()"></form>
to allow users to reset the page after viewing some answers with an onmousover event. (I want the answers to remain visible until the viewer chooses to reset).

Is it possible to have the page reload and scroll down to a particular anchor point? At the moment it reloads and puts the reader back at the top of the page.

Thanks in advance!

(Page is under construction, but can be viewed here - see question (1c)
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
 
Register now for full access!
Old 05-13-2010, 05:36 PM Re: Button which allows users to refresh page
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I'm not sure history.go is the best way to do what you want, but since you're already using it here's what you'd likely want to do.

You can list a URL inside the parenthesis so for the page you linked to

Code:
history.go("http://www.mymusictheory.com/grade6/exercises/harmony6-harmonising-a-melody.html")
Now that won't change anything from what you're doing now, but it's the first step. What you want to do is create named anchors. Where you want the page to load find an element and give it an id.

For example say you wanted the page to reload so Chords Which Fit is at the top. Here's your code around that text.

HTML Code:
<h2><strong>Chords Which Fit </strong></h2>
Give the h2 an id

HTML Code:
<h2 id="top"><strong>Chords Which Fit </strong></h2>
With that done you can change the history.go like so

Code:
history.go("http://www.mymusictheory.com/grade6/exercises/harmony6-harmonising-a-melody.html#top")
Notice the #top at the end of the url.

You can have as many named anchors as you want on a page so if you decided to have more exercises on a page you could add ids to different parts of the page and then adjust the history.go method accordingly for where you want the page to reload to.

Hope that helps.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-14-2010, 12:51 AM Re: Button which allows users to refresh page
magicvw's Avatar
Extreme Talker

Latest Blog Post:
Ye Olde Christmas Music
Posts: 235
Name: Vicky
Location: Brit in Bulgaria
Trades: 1
Thanks - that's exactly what I was after!

You said you don't think it's the best way to go about it - how would you do it?
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 05-14-2010, 05:04 PM Re: Button which allows users to refresh page
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Glad I could help.

Well the history.go approach is probably simpler, but I think I'd write a function that cleared the answers without refreshing the page. More of an Ajax solution though not one that would need to interact with a database unless you wanted to store things in a database for some reason.

The function would have to interact with the DOM quite a bit to hook into the specific answers and clear the content from the specific elements. Probably use document.getElementById() to hook into the specific element and then removeChild() to clear the content

Something like that anyway. It would naturally be a little more coding, but I think it would ultimately be more flexible and wouldn't require refreshing the page at all.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-15-2010, 04:30 AM Re: Button which allows users to refresh page
magicvw's Avatar
Extreme Talker

Latest Blog Post:
Ye Olde Christmas Music
Posts: 235
Name: Vicky
Location: Brit in Bulgaria
Trades: 1
Hmm, just trying to implement this, and it's not working...

My code:
Code:
<p id="c1">c) Chords <img src="chords-1.jpg" alt="chords" width="605" height="180" align="top" 
	onmouseover="this.src='chords1a.png';"
	onmouseout="this.src='chords1a.png';" /></p>
   <br />

<form><input type=button value="Clear Answers" onClick="history.go('http://www.mymusictheory.com/grade6/exercises/harmony6-harmonising-a-melody.html#c1')"  />
  
</form>
here

I copied what you put exactly, and it didn't work at all. So I replaced the double quotes with single ones, and it works, but it doesn't recognise the id anchor. Have I done something wrong?
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 05-15-2010, 05:23 AM Re: Button which allows users to refresh page
magicvw's Avatar
Extreme Talker

Latest Blog Post:
Ye Olde Christmas Music
Posts: 235
Name: Vicky
Location: Brit in Bulgaria
Trades: 1
OK - found a neater solution - just changing the img with ondblclick instead works fine! Thanks anyway!
__________________

Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 05-16-2010, 10:41 PM Re: Button which allows users to refresh page
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Cool. Glad you found a solution even if it wasn't mine.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-20-2010, 03:20 AM Re: Button which allows users to refresh page
Banned

Posts: 101
Name: udtek1
Trades: 0
Great. It really work, thank you!

Last edited by chrishirst; 05-20-2010 at 05:36 PM..
udtek1 is offline
Reply With Quote
View Public Profile Visit udtek1's homepage!
 
Old 05-24-2010, 12:48 AM Re: Button which allows users to refresh page
Average Talker

Posts: 21
Name: Martin Johnson
Trades: 0
THis solution reloads page directly where the viewer was entering or reading? Would be useful for the news site i am currntly building.
Webbster21 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Button which allows users to refresh page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44552 seconds with 12 queries