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 25th, 2004, 01:29 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 5 m 58 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Question Text change on click event?...another thought...

Thanks shamrog12 for the help, but you got my little brain going. I know one can write HTML (or is it java) so that when a mouseover event or click event happens, you can have an image change. Can you do this with blocks of text? Maybe long strings of text?
What I was thinking was a different way to do a FAQ page. Instead of the normal questions at the top that link you to a lower area on the "way too long" page, or have the answers as pop-ups, or something, I thought about having text contents in main body or specific location, change depending on the question that's clicked somewhere else on the page. I didn't know if a variable is assigned a value of a string, then the value changes depending the link clicked.

Sorry if this is a basic question, but I've never even thought of going this route.

Thanks
-Jim

Reply With Quote
  #2  
Old October 25th, 2004, 01:59 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
Don't confuse Java and Javascript VERY different worlds. To answer your question, yes you can do this with javascript and you can do this about 50 different ways and many of the differences are cosmetic rather than environment-specific differences.

You can use a javascript onmouseover and onmouseout to show/hide layers with text in it.

You can use javascript to change the content of a textarea so that when you roll over the text of a question, the answer will temporarily be written to a textarea.

You can actually have the browser dynamically "insert" code into the web page on a mouseover, however, this is not cross-browser compatible, plus it's a bit of a pain.

There are many other options, maybe one of these will get you thinking further?
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.


Reply With Quote
  #3  
Old October 25th, 2004, 02:14 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,993 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 16 h 39 m 38 sec
Reputation Power: 1557
yes you can... you can use such code to display the answers when the mouse is over question:
Code:
 <script language="javascript">
   function ShowHideAnswer(objDiv, strDisplay)
   {
    var strDivID=objDiv.id;
    var arrTmp=strDivID.split("_");
    if (arrTmp.length < 2)
    {
 	  alert("error: invalid object.\nobject id: "+strDivID);
 	  return false;
    }
    var strFaqId=arrTmp[1];
    var strAnswerId="answer_"+strFaqId;
    var objAnswer=document.getElementById(strAnswerId);
    if (!objAnswer)
    {
 	  alert("error: answer object does not exist.\nexpected id: "+strAnswerId);
 	  return false;
    }
    objAnswer.style.display = strDisplay;
    return true;
   }
   
   function ShowAnswer(objDiv)
   {
    return ShowHideAnswer(objDiv, "block");
   }
   
   function HideAnswer(objDiv)
   {
    return ShowHideAnswer(objDiv, "none");
   }
 </script>
 <div id="question_1" onmouseover="ShowAnswer(this);" onmouseout="HideAnswer(this);">Question #1: what is cat? </div>
 <div id="answer_1" style="display: none;">cat is cute little animal. ussually used as pet. </div><br />
 <div id="question_2" onmouseover="ShowAnswer(this);" onmouseout="HideAnswer(this);">Question #2: what is dog? </div>
 <div id="answer_2" style="display: none;">dog is fierce animal with sharp teeth. tends to wag its tail.</div><br />
 <div id="question_3" onmouseover="ShowAnswer(this);" onmouseout="HideAnswer(this);">Question #3: what is ASP? </div>
 <div id="answer_3" style="display: none;">ASP is Active Server Pages. nice language. asp is kind snake.</div><br />
 

Reply With Quote
  #4  
Old October 25th, 2004, 11:31 AM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 5 m 58 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Hmmm,
You're right, they all seem like good possibilties. Being that this is for a business, I should stay away from cross-browser problems. Also, instead of mouseover, I think one should click on the question and have the answer appear. that way one can copy-paste the info if needed.
When you say textarea, does that mean the text would appear in the page like normal? Or into a scrollable box like a textarea box in Access? I'd like to keep a natural look to the page.

Thanks
Jim

Reply With Quote
  #5  
Old October 25th, 2004, 11:43 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
a textarea like <textarea></textarea> so it would technically scroll. You might try looking at http://www.dynamicdrive.com for some DHTML scripts that might do the trick. I'm sure there are some there. They test their scripts so what I give you would potentially have bugs whereas theirs are probably more reliable.

Reply With Quote
  #6  
Old October 25th, 2004, 12:11 PM
OneRedLT4's Avatar
OneRedLT4 OneRedLT4 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: California
Posts: 299 OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level)OneRedLT4 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 h 5 m 58 sec
Reputation Power: 7
Send a message via AIM to OneRedLT4 Send a message via Yahoo to OneRedLT4
Awesome! I think what I'm looking for is "IFrames" which I've never heard of before, but I'm definately bookmarking that site, and going to play around with it!

Thanks Again.

-Jim

Reply With Quote
  #7  
Old October 25th, 2004, 12:18 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
not cross-platform or cross-browser. iFrames SUCK but for some reason people like to use them. Consider alternatives that may be more W3C compliant

Reply With Quote
  #8  
Old October 26th, 2004, 01:01 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,993 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 16 h 39 m 38 sec
Reputation Power: 1557
1. you can alter my code by simply changing onmousever to onclick
2. talking about scrollbars, you can have auto-scroll <div> tag using css like this:
Code:
<div style="overflow: scroll; width: 200px; height: 100px;">
 hello world! this text should appear in scrollable area.<br />
 are the scroll bars both present?</div>
and it's even cross browser.

Reply With Quote
  #9  
Old October 26th, 2004, 01:10 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
yes, this is an appropriate XHTML solution that will work for all browsers. Note that Shadow Wizard made the code XHTML compatible (even if the style attribute is being deprecated). It's a good solution using good code.

Thanks Shadow Wizard.

Reply With Quote
  #10  
Old October 26th, 2004, 01:16 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,993 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1Folding Points: 342508 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 16 h 39 m 38 sec
Reputation Power: 1557
style is being deprecated?
hmm... yeh now I remember.
well, simply replace style with class and define proper style sheet...

Reply With Quote
  #11  
Old October 26th, 2004, 01:22 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
yeah, i was/am a fan of using the style attribute because I tend to have about 100 variations on each class, all distinguished by minor differences in the style (text-align:left;, text-align:center; etc.). I have to change my ways because of it Could be worse. Could be using <font> tags. I shudder at the thought.

Reply With Quote
  #12  
Old October 26th, 2004, 05:12 AM
ratmilk ratmilk is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Melbourne, Australia
Posts: 22 ratmilk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Iframes

if you want to use iframes:
Code:
<iframe scr="mypage.asp" height="200" width="200" border="0">

or you can use a Iframe Genorator at http://www.cmg02.com/cg2/iframe.htm
you do NOT have to close iframes!

Reply With Quote
  #13  
Old October 26th, 2004, 09:32 AM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)