Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
probel using onClick for hidden form
Old 07-20-2008, 08:41 PM probel using onClick for hidden form
Skilled Talker

Posts: 69
Trades: 0
The forms are one on to of each other and I want them to replace each other. Any way I can make that happen?

I am using the following javascript:

Code:
<script type=text/javascript>
var isIE=document.all?true:false;
var isDOM=document.getElementById?true:false;
var isNS4=document.layers?true:false;

/* _w : which ID (1) or (2) */
/* _h : (h)ide or (s)how */
function toggleT(_w,_h) {
  if (isDOM)
  {
    if (_h=='s') document.getElementById(_w).style.visibility='visible';
    if (_h=='h') document.getElementById(_w).style.visibility='hidden';
  }
  else if (isIE) {
    if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
    if (_h=='h') eval("document.all."+_w+".style.visibility='hidden';");
  }
  else if(isNS4)
  {
    if (_h=='s') eval("document.layers['"+_w+"'].visibility='show';");
    if (_h=='h') eval("document.layers['"+_w+"'].visibility='hide';");
  }
}
</script>
I am using in the context:

Code:
<table border="0" cellspacing="0" cellpadding="0" align="right" height="16" bgcolor="#F4EAF3"> 
<tr>
<td align="right" bgcolor="#F4EAF3" valign="middle"><font size="-2" color="#993399"><b>Search:</b></font></td>
<td align="left" bgcolor="#F4EAF3" valign="middle"><form action"" class="searchbox"><input type="radio" name="websitesearch" value="website" class="inputradio" checked onClick="toggleT('divt1','s') + toggleT('divt2','h')"><font size="-2">search</font><br><input type="radio" name="websitesearch" value="webpages" class="inputradio" onClick="toggleT('divt2','s') + toggleT('divt1','h')"><font size="-2">Wedding Websites</font></form></font></td>
<td align="left" bgcolor="#F4EAF3" valign="middle"><span id="divt1" style="visibility:visible;position:static;top:0;left:0">
<form id="removed" action="removed" class="searchbox"><input type="hidden" name="cx" value="removed" /><input type="hidden" name="cof" value="FORID:9" /><input name="q" type="text" size="25" class="inputsearch"/>  <input type="submit" name="sa" class="submitsearch" value="Search" /></form></span>
<span id="divt2" style="visibility:hidden;position:static;top:0;left:0;"><form method="post" name='SearchForm' action="removed" class="searchbox"><input type="text" maxlength="25" name="searchword" value="Last Name" size="25" class="inputsearch"/>  <input type="submit" class="submitsearch" value="Search" /></form>
</span>
</td></tr></table>
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-21-2008, 04:41 AM Re: probel using onClick for hidden form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
create the elements into DOM "on the fly" using a checkbox rather than a radio button, similar to this -> http://www.webmaster-talk.com/javasc...d-new-box.html
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-21-2008, 10:58 PM Re: probel using onClick for hidden form
Super Talker

Posts: 116
Trades: 0
if i recall correctly, visibility just makes it invisible, but keeps the element still expanded (so it takes up space, and just leaves a blank white spot when ="hidden")

i suggest using a css/js combo, like doing:

Code:
document.getElementById(_w).style.display=''; //Reveals
document.getElementById(_w).style.display='none'; //Hides
And then in each element in the html part, just add a style="display:none;" so that when they first come to the page they'll all be hidden (or leave out whatever u want default displayed, etc).

but basically display will collapse the hidden ones while visibility will just make it... white.

ps: you use null ('') to reveal it because IE screams if you put 'visible'. the '' just overrides the 'none' and so it still shows up.
__________________


Please login or register to view this content. Registration is FREE

nasaboy007 is offline
Reply With Quote
View Public Profile Visit nasaboy007's homepage!
 
Old 07-22-2008, 10:27 AM Re: probel using onClick for hidden form
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Code:
if (_h=='s') eval("document.all."+_w+".style.visibility='visible';");
is the same as
Code:
if (_h=='s') document.all._w.style.visibility='visible';
So you don't need to use eval.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 07-22-2008 at 10:34 AM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-22-2008, 10:39 AM Re: probel using onClick for hidden form
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
if i recall correctly, visibility just makes it invisible, but keeps the element still expanded (so it takes up space, and just leaves a blank white spot when ="hidden")
Correct.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to probel using onClick for hidden form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49471 seconds with 12 queries