...

View Full Version : Backbutton in CSS



rossoreed
11-03-2011, 11:32 PM
I have tried to build a website to display data on my iphone, and used a CSS template which I have amended.
The site as can be seen here (http://powerhub.info/iphone/#_Hub) works OK, except that the backbutton takes me back to the home page each time, instead of working like a breadcrumb (taking me back just one level).

This is my first website and any help would be appreciated to get this to work properly, as I have tried now for the past few days and failed miserably!

I have attached 2 text files, the index & css files.

Mr.
11-04-2011, 11:45 AM
You have no backbutton on the page... what are you talking about? The only button I see added when you click through is the "Hub" button and that obviously will take you back to the home page.

Please tell me what "back" button you're talking about.

rossoreed
11-04-2011, 01:06 PM
You have no backbutton on the page... what are you talking about? The only button I see added when you click through is the "Hub" button and that obviously will take you back to the home page.

Please tell me what "back" button you're talking about.
I want the 'Hub' button to become a backbutton, so instead of taking me back to the home page, it takes me to the last hierarchical page.
So, for example;
From the home page 'Hub' (http://powerhub.info/iphone/#_Hub), I select 'Instant Power Data', and then select 'Solar Power', I would like the 'Hub' button to then display 'Instant Power Data', and take me to the 'Instant Power Data' page if I select it.

This is what I have been trying to achieve, (and failed so far!)

_Aerospace_Eng_
11-04-2011, 03:38 PM
You would need to use javascript to "go back" or keep track of the page the user is on and update the url for that button. This can be done with php, or javascript. Seeing as how you are using a template, you probably won't know how to do it in php so the simplest thing would be to change this

<a id="homeButton" class="button" href="#Hub">Hub</a>
to this

<a id="homeButton" class="button" href="#Hub" onclick="window.history.go(-1);return false">Back</a>

rossoreed
11-04-2011, 03:51 PM
You would need to use javascript to "go back" or keep track of the page the user is on and update the url for that button. This can be done with php, or javascript. Seeing as how you are using a template, you probably won't know how to do it in php so the simplest thing would be to change this

<a id="homeButton" class="button" href="#Hub">Hub</a>
to this

<a id="homeButton" class="button" href="#Hub" onclick="window.history.go(-1);return false">Back</a>
Thanks, I have amended the code, but it does not seem to work, see http://powerhub.info/iphone/#_hub
It seems to try and go back, but changes it's mind, and returns to the same page.

Mr.
11-04-2011, 09:14 PM
I don't believe you have to use javascript to fix this... please attach the javascript file as well though. thanks.

rossoreed
11-04-2011, 09:18 PM
I don't believe you have to use javascript to fix this... please attach the javascript file as well though. thanks.
Attached is the iphonenav.js file saved as a text file.

rossoreed
11-05-2011, 02:25 PM
Thanks for the comments and suggestions, but I have located the template authors website http://www.iui-js.org/ which has an updated version - with backbuttons!
My mobile site is now working at http://powerhub.info/mobile/#_Hub if you want to see it in action.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum