Help - Search - Members - Calendar
Full Version: Valid Xhtml Way Of Making A "bookmark" Link?
Zymic Webmaster Forums > Web Design & Development > General Web Design Discussion
Sapphiro
Hi guys, I'm still learning to code fully xhtml-valid sites, rite now I got this feature where you can make my site your homepage, but it's in javascript, which somehow doesnt pass the xhtml validator from w3c. Anyone know any valid way of recoding the feature into css? smile.gif

CODE
<div id="top-container"><a class="top" href="java script:;" onClick="try{ if(document.all) { this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.sapphiro.net'); } else if(!window.opera && window.sidebar) { $('firefox_homepage_setup').style.display = ''; } else { $('all_homepage_setup').style.display = ''; } } catch(e) { $('all_homepage_setup').style.display = ''; }">• Bookmark Our Site!</a></div>



my site: http://www.sapphiro.net/ (Ps, the bookmark link is also a little off in different resolutions, needa fix)
validator: here


btw, are the "quick links" on my main home page redundant? tongue.gif
rockacola
QUOTE(Sapphiro @ Oct 19 2008, 01:33 PM) *
Also, do you find the "quick links" on my main home page a little redundant? tongue.gif

I found it misleading tongue.gif
In my opinion, "Quick Link" tends to mean shortcuts within your website.

I'll have a look of validator later tomorrow smile.gif
Bread
QUOTE(Sapphiro @ Oct 19 2008, 02:33 PM) *
Hi guys, I'm still learning to code fully xhtml-valid sites, rite now I got this feature where you can make my site your homepage, but it's in javascript, which somehow doesnt pass the xhtml validator from w3c. Anyone know any valid way of recoding the feature into css? smile.gif

CODE
<div id="top-container"><a class="top" href="java script:;" onClick="try{ if(document.all) { this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.sapphiro.net'); } else if(!window.opera && window.sidebar) { $('firefox_homepage_setup').style.display = ''; } else { $('all_homepage_setup').style.display = ''; } } catch(e) { $('all_homepage_setup').style.display = ''; }">• Bookmark Our Site!</a></div>

my site: http://www.sapphiro.net/ (Ps, the bookmark link is also a little off in different resolutions, needa fix)
validator: here
btw, are the "quick links" on my main home page redundant? tongue.gif


You just wrap it in a function, then enclose within a CDATA section::

CODE
<script type="text/javascript">
/*<![CDATA[*/
function makeHomepage()
{
   // body of function

   return false;
}
/*]]>*/
</script>

<a href="alinkfornonjscompatbrowsers.html" onclick="return makeHomepage()">Bookmark our site</a>


This in all fairness is a rather shady tactic though, you state 'Bookmark our site' and then you make your site their home page... There are ways to actually set a bookmark, have a google if you don't know them.

I tend to agree that the 'quick links' lacks purpose, bookmarks within the browser serve that purpose.
Sapphiro
hey bread, what do I fill in for the "body of function" area?tongue.gif I never learnt javascript before. =x
Bread
QUOTE(Sapphiro @ Oct 22 2008, 03:48 PM) *
hey bread, what do I fill in for the "body of function" area?tongue.gif I never learnt javascript before. =x


That would be your js for setting the home page, the bit in your onclick handler at the moment.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.