HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 1st, 2004, 02:58 PM
jbruso jbruso is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 279 jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 17 h 31 m 46 sec
Reputation Power: 5
Send a message via AIM to jbruso Send a message via MSN to jbruso Send a message via Yahoo to jbruso
Question If/Then for JavaScript Make my HomePage

Hi guys, ... a small challenge here...

I have this script that can change your default home page, but I want to display it only if the user's current default home page is not set to the one i will set it to... so, if you have your homepage set correctly, you don't get the message on the page and if you have it set as something else, you do get the message.

I'm not sure the best way to do this, javascript or asp... and how


Code:
 <table width="723" border="0" cellspacing="1" cellpadding="5">
<tr>
	<td align="center"><img src="../images/hand.gif" width="26" height="14" border="0" align="middle"> 
<font color="#FF9900"><strong>Helpful Tip</strong>: Do you use e-Services several 
times a day? Reduce your clicks and <SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// If it's Internet Explorer, use automatic link
if (document.all){
document.write('<A HREF="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';thi  s.setHomePage(\'http://www.sheridan.edu/eservices\');">');
document.write('Make e-Services Your New Start-Page</a>');
}
// If it's any other browser, for which I don't know the specifications of home paging, display instructions
else {
document.write('<b>Make this site your home page:</b><br>- Go to <b>Preferences</b> in the <B>Edit</B> Menu.<br>- Choose <b>Navigator</b> from the list on the left.<br>- Click on the <b>"Use Current Page"</b> button.');
}
// End -->
</script>
.</td>
</tr>
</table> 


Anyone up to the challenge?

Reply With Quote
  #2  
Old October 1st, 2004, 04:59 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
Example:
Code:
<HTML XMLNS:IE>
<HEAD>
<STYLE>
@media all {
   IE\:homePage {behavior:url(#default#homepage)}
}
</STYLE>

<script language="Javascript">

function check_homepage()
{
   sQueryHome = oHomePage.isHomePage(location.href);

   if (sQueryHome)
   {
      alert('This page is the users home page');
   } 
   else 
   {
      alert('This page is not the users home page');
      write the link to set the home page
   }
		
}
</script>
</HEAD>
<BODY onload="check_homepage()">
<IE:homePage ID="oHomePage" />
</BODY>
</HTML>

Reply With Quote
  #3  
Old October 1st, 2004, 06:08 PM
jbruso jbruso is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 279 jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level)jbruso User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Days 17 h 31 m 46 sec
Reputation Power: 5
Send a message via AIM to jbruso Send a message via MSN to jbruso Send a message via Yahoo to jbruso
Question

It looks like this writes either one whole page from the javascript or nothing at all... that's monstrous...

Code:
<HTML XMLNS:IE>
<HEAD>
<STYLE>
@media all {
IE\:homePage {behavior:url(#default#homepage)}
}
</STYLE>
<script language="Javascript">
function check_homepage()
{
sQueryHome = oHomePage.isHomePage(location.href);
if (sQueryHome)
{}
else 
{
document.write('<table width="723" border="0" cellsp'
+'acing="1" cellpadding="5"><tr><td align='
+'"center"><img src="/images/eservices/hand.gif" wid'
+'th="26" height="14" border="0" align="middle"> <fo'
+'nt color="#FF9900"><strong>Helpful Tip</strong>: D'
+'o you use e-Services several times a day? Reduce y'
+'our clicks and'); 
document.write('<A HREF="javascript:history.go(0);" onClick="this.style.behavior=\'url(#default#homepage)\';thi  s.setHomePage(\'http://dev.sheridan.edu/eservices/test.asp\');">');
document.write('Make e-Services Your New Start-Page</a>');
document.write(".</td></tr></table>");
}
 
}
</script>
</HEAD>
<BODY onload="check_homepage()">
<IE:homePage ID="oHomePage" />
YOU SHOULD BE ABLE TO SEE THE REST OF THE PAGE BUT YOU CANT... ONLY THE STUFF IN THE JAVASCRIPT IS BEING WRITTEN TO THE PAGE
</center>
</BODY>
</HTML>



I only want to either write or not write this HTMl (as though I were writing a variable on a page) within the rest of the page:

Code:
 <table width="723" border="0" cellspacing="1" cellpadding="5">
<tr>
	<td align="center"><img src="/images/eservices/hand.gif" width="26" height="14" border="0" align="middle"> <font color="#FF9900"><strong>Helpful Tip</strong>: Do you use e-Services several times a day? Reduce your clicks and .</td>
</tr>
</table> 

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > If/Then for JavaScript Make my HomePage


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway