HTML & WEB-Design

Moderators: Jonathan
Number of threads: 1249
Number of posts: 3348

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Activate slider function from link on previous page Posted by PixelPusher on 1 Feb 2009 at 8:15 PM
Tried this:
<a href="../main/cd-dvd-bd/index.php?$('sixteen').removeClass('hide');return false;"><img src="img/index_set/features/c.jpg" width="150" height="150" class="gradualfader" alt="Featured #3" /></a>

Did not work.

My goal is to make this scenario work.

From this page ( link from one image in "Featured Items" ) :
http://www.glmt.com/

to

This page ( remove class "hide" and slide to div id="sixteen" ) :
http://www.glmt.com/main/cd-dvd-bd/index.php

Is this possible? Could someone lead me in the right direction?

Thanks!



Report
Re: Activate slider function from link on previous page Posted by CyGuy on 4 Feb 2009 at 7:28 AM
there is no element with id="sixteen"
Report
Re: Activate slider function from link on previous page Posted by PixelPusher on 11 Feb 2009 at 3:47 PM
Sorry.
Looking at the HTML, near the end, you'll
find "
<div id="sixteen" class="hide" name="Branded_Disc">
"

id="sixteen"

Will the hyperlink code that I used above work? What am I missing?

Thanks.
Report
Re: Activate slider function from link on previous page Posted by PixelPusher on 2 Mar 2009 at 2:58 PM
Sorry for the repost. Just wondering if I could get more insight on the above question?

Thanks.
Report
Re: Activate slider function from link on previous page Posted by CyGuy on 7 Mar 2009 at 11:00 PM
Cookies are the best
WHAT you;see_is_what=you.get;
-Russ aka DangeRuss
Report
Re: Activate slider function from link on previous page Posted by PixelPusher on 8 Mar 2009 at 12:20 PM
How will cookies allow the user to see this page
glmt.com, plus remove class "hide" and slide to div id="sixteen" after clicking
on a link in this page?

I'm afraid that I don't have much practice using cookies.
I'm I doing this correctly? Please see the following:

Page one:
<script language="javascript" type="text/javascript">
function writeCookie(templatespage, feature3button, 1)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}
</script>

<a href="../main/cd-dvd-bd/index.php"><img src="img/index_set/features/c.jpg" width="150" height="150" class="gradualfader" alt="Featured #3" /></a>



Page two
<script language="JavaScript">
write("$('sixteen').removeClass('hide');return false;") = 
readCookie('feature3button');</script>
Report
Re: Activate slider function from link on previous page Posted by CyGuy on 9 Mar 2009 at 3:47 AM
I'm afraid that there are two intertwined programming languages here that run on separate machines: Javascript and PHP

javaScript is a client technology that works well with the HTML (that contains the ID attribute) and CSS (where the style is at). All of these are client technologies.

Your server runs PHP to deliver, and collect, the content to the client computers to run the content. Although PHP can rewrite the code to be interpreted by the client computer, it is the HTML, CSS and javaScript mechanisms that load content to be displayed on the computer.

The cookie stores a value, because the client computer doesn't keep anything on a document when the address changes and PHP sends another page.

In your first post you attempted a to make a link to this address: ../main/cd-dvd-bd/index.php?$('sixteen').removeClass('hide');return false;. The problem is that the ? in the link tells php that there are additional values it should be aware of when broadcasting the code. This behavior is similar to submitting a form, whereas a cookie stays on the client computer. And the above is javaScript code that will not be understood by PHP. That is the reason I recommend cookies.

Moving on, here is some javaScript code that might help:
function writeCookie(name,escape)
{
  document.cookie = name + "=" + escape(value); 
}
</script>

<a onclick="writeCookie('featuredButton','sixteen')" href="../main/cd-dvd-bd/index.php"><img src="img/index_set/features/c.jpg" width="150" height="150" class="gradualfader" alt="Featured #3" /></a>


By adding the above code to page one, you inform the next page to that the cookie templatespage has the value of the desired slider location. There is more work for the next page. Some hints: load the cookie value first so the client has a value to compare... remember these are conditional effects that you desire... the document is where the client stores the effects, so document is your top level container.
var featuredButton = readCookie('featuredButton')
slidingtabs.changeTo(featuredButton);
document.getElementById(featuredButton).removeClass('hide');


The first line in the above code is from some commented out scripts on line 325 of the second page and probably depends on the SlidingTabs object found in one of the includes from the script tags starting around line 30.

I could go on, but this ought to get you started. I suggest a slimmed down test-bed to get the configuration right. I typically remove everything that is not neede to provide the desired effect.



document.referrer



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.