?
Solved

Dynamic text field (label) with no border?

Posted on 2003-02-19
9
Medium Priority
?
618 Views
Last Modified: 2008-01-09
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
Comment
Question by:Kirtley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 30

Expert Comment

by:third
ID: 7985281
why netscape 4.8? there's a way on later browsers but on ns4.8 i'm afraid it's not implemented yet.
0
 
LVL 4

Expert Comment

by:whammy
ID: 7985311
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
 
LVL 30

Expert Comment

by:third
ID: 7985317
0
Independent Software Vendors: 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!

 
LVL 4

Expert Comment

by:Sashi Rachabattula
ID: 7985659
try this
<INPUT id=text1
style="BORDER-BOTTOM: 0px;BORDER-top: 0px;BORDER-right: 0px;BORDER-left: 0px;" name=text1 value="hello" readonly>
0
 

Author Comment

by:Kirtley
ID: 7990150
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
 

Expert Comment

by:rezzzman
ID: 7995484
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
 

Author Comment

by:Kirtley
ID: 7997391
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
 

Accepted Solution

by:
rezzzman earned 200 total points
ID: 8068313
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
 

Author Comment

by:Kirtley
ID: 8069022
Thanks rezzzman!

That works - great!

Thanks very much.

Chris
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question