Forum Moderators: open
onfocus="this.size='25';ACname.style.display='block';"
in this the first part works even in ff, but the second one with the id of my div ACname dosent work
maybe i am missing something.. plz help
thanks in advance
document.getElementById('ACname').style.display='block';
and make sure there's an id on the element. If you don't use id's, you should, but you can do
document.forms['formname'].ACname.style.display='block';
or
document.forms[0].ACname.style.display='block';
where 0 is the index of the forms array in the source; so if it's the second form it would be forms[1].
plus in dreamweaver the 'document' dosent even turn pink.. as it does in <script > tags (which is quite understandable as there are no script tags)
and i cant use the doc.forms as ACname is not an input or any other form tag but a div/span which lies right below the input tag and inside the 'form' tags.. i'v used 'this' for the inputs as you can see in the first part "this.size='25';" and it works in ff
so the thing i could conclude is that:
the getelementbyid dosent work without script tag,
i cannot use doc.forms as it target element is not a form obj but a div/span plus the 'documnt.' dosent work (dont know why)
i am now thinking to make all this a function and use the target div's id as a variable but i would still, just out of curiosity, would like to know what stopped it from working only in ff...
<html>
<head>
<title>Test</title>
<style type="text/css">
#ACname {
display: none;
}
</style>
</head>
<body>
<input onfocus="this.size='25';document.getElementById('ACname').style.display='block';"
name="foo" value="bar">
<div id='ACname'>This is hidden</div>
</body>
</html>