View Full Version : input text value not showing

Oct 29th, 2009, 03:50 PM

I have a form with text boxes which I need to display values ie.
<input type="text" name="image_ref" value="image1" />

This works no porblem until I enter the below javscript onto the page:

<script type="text/javascript">

var level1 = document.getElementById('level1');
level1.style.display = 'none';
var level2 = document.getElementById('level2');
level2.style.display = 'none';
var all_levels = document.getElementById('all_levels');
all_levels.style.display = 'none';


This code is to hide certain parts of the form until they are activated. the problem is when the parts of the form are activated and displayed, the values inthe text input boxes do not show. Any ideas why this is?

many thanks in advance.

Philip M
Oct 29th, 2009, 05:34 PM
Iin Internet Explorer, names and IDs are global variables and thus you should NEVER use a global variable or function name which is the same as an HTML element name or ID.

Apart from that, I do not see any elements with the ids level1 and level2.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

Oct 29th, 2009, 06:33 PM
I dont have any variables names the same as HTML elements. Any other ideas? :0/

Philip M
Oct 29th, 2009, 07:11 PM
I dont have any variables names the same as HTML elements. Any other ideas? :0/

var level1 = document.getElementById('level1');

Well, what's that? Scotch mist?

Oct 30th, 2009, 11:15 AM
oooops, sorry, misunderstood what you were saying.

That was the problem, thankyou