• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 620
  • Last Modified:

Dynamic text field (label) with no border?

Is there a way to make a label in Javascript? In other words, I want a text field that has no border, but which can be changed dynamically. It sounds easy, but I have agonized for ages and can't find a way to do it! Oh, and by the way, I'd like it to work in Netscape version 4.8 (I hate any other browser!).

TIA
0
Kirtley
Asked:
Kirtley
  • 3
  • 2
  • 2
  • +2
1 Solution
 
thirdCommented:
why netscape 4.8? there's a way on later browsers but on ns4.8 i'm afraid it's not implemented yet.
0
 
whammyCommented:
If you want to use modern techniques, you should avoid using an ancient browser. :)

I only test as far back as Netscape 4.78 - and not for full compatibility, since old versions of Netscape don't support much.

I just make sure it ain't broke in those old browsers. :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Sashi RachabattulaSCRUM Master, .NET Project LeadCommented:
try this
<INPUT id=text1
style="BORDER-BOTTOM: 0px;BORDER-top: 0px;BORDER-right: 0px;BORDER-left: 0px;" name=text1 value="hello" readonly>
0
 
KirtleyAuthor Commented:
Thanks to all.

The reason I am using N4 is that I can't stand IE or N6. Sorry, but I'm stubborn!

That last solution (rsashi) didn't work. It just made a normal-looking text box with a border.

I suspect there is no solution to this (I guess that's what Thrid's page about layers is about?), but thought I'd ask just in case.

The page I am trying to fix is here, BTW: http://www.univie.ac.at/cga/radio

I was trying to put simple labels under the long slider to indicate the time. If you can think of anothe rway to do this I'll accept that as an answer!

Cheers,

Chris

0
 
rezzzmanCommented:
Hmmm... Im not sure if what you want is possible, however you can swap textlayers in and out like people do with image rollovers. And just like image rollovers, there are a few ie/ns specifics to be mindfull of. Here is a quick (non-optimized) example. Maybe this will suite your needs?

<HTML>
<HEAD>
<SCRIPT Language="Javascript">
<!--
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function view(layername) {
  if (ns4) {
    mylayer=document[layername]
    // hide all layers
    for (n=0;n < document.layers.length;n++)
         document.layers[n].visibility="hide";
    // Show specified layer
    mylayer.visibility="show";
  }
  else if (ie4) {
    mylayer=document.all[layername].style;
    // hide all layers
    for (n=0;n < document.all.length;n++) {
      if (document.all[n].style.position == "absolute") {
        document.all[n].style.visibility = "hidden";
      }
    }
    // Show specified layer
    mylayer.visibility="visible";
  }
  else
  {
    alert("This page requires Netscape or IE version 4.0+");
  }
}

//-->
</SCRIPT>
</HEAD>
<BODY>
  Status :
  <DIV ID="s1" STYLE="position:absolute; visibility:hidden;">Pending Creation</DIV>
  <DIV ID="s2" STYLE="position:absolute; visibility:hidden;">Active</DIV>
  <DIV ID="s3" STYLE="position:absolute; visibility:hidden;">Pending Removal</DIV>
  <DIV ID="s4" STYLE="position:absolute; visibility:hidden;">InActive</DIV>
  <BR>
  <A href="#" onclick="view('s1')">show s1</A>
  <A href="#" onclick="view('s2')">show s2</A>
  <A href="#" onclick="view('s3')">show s3</A>
  <A href="#" onclick="view('s4')">show s4</A>
</BODY>
</HTML>
0
 
KirtleyAuthor Commented:
Yes, I noticed the layer idea, rezzzman, but I don't think it helps, because I need to define the text dynamically. In your example, you are just switching between predefined strings.

Thanks, but no cigar!

I really think it's impossible, but it seems such an easy thing that it frustrates me. I wonder if the browser-designers excluded this to prevent people writing text on the fly and tricking users? That's the only reason I can figure for not implementing dynamic labels.

Chris
0
 
rezzzmanCommented:
Sorry it has been a while. Been busy. I think you are looking for something like this maybe:

<HTML>
<HEAD>
<SCRIPT Language="Javascript">
<!--

function changeLayer(layername,textvalue)
{
  if (document.layers) {
    mylayer=document[layername];
    mylayer.document.open();
    mylayer.document.write(textvalue);
    mylayer.document.close();
  }
  else if (document.all) {
    mylayer=document.all[layername];
    mylayer.innerHTML = textvalue;
  }
  else if (document.getElementById)
  {
     mylayer = document.getElementById(layername);
     mylayer.innerHTML = "";
     mylayer.innerHTML = textvalue;  
  }
  else
  {
     alert("This page requires Netscape or IE version 4.0+");
  }
}
//-->
</SCRIPT>
</HEAD>
<BODY>
Status :
<DIV ID="s1" STYLE="position:absolute;">Time 1:10:00.00</DIV>
<BR>
<FORM name="test" onSubmit="false">
Set text <input type="text" name="s1new" value="Time 1:10:00.00"><input type="button" value="change" onClick="changeLayer('s1',document.test.s1new.value)"><BR>
</BODY>
</HTML>
0
 
KirtleyAuthor Commented:
Thanks rezzzman!

That works - great!

Thanks very much.

Chris
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now