Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: RE: javascript digest: June 13, 2000


Message #1 by Julian Skinner <julians@w...> on Wed, 14 Jun 2000 12:56:29 +0100
IE doesn't support layers, so it won't recognize myA as an object unless you
alter your HTML as well as the JavaScript. You'll need a <DIV> or similar
with a style specifying "position:absolute". Try this:

<HTML>
<HEAD>
<STYLE>
.myStyle { position:absolute;
           top:100;
           left:100
}
</STYLE>
<SCRIPT>
function fnClick() {
   if (navigator.appName == 'Microsoft Internet Explorer') {
      var myText = document.forms['myForm'].elements['myText'];
   } else {
      var myText 
document.layers['myDiv'].document.forms['myForm'].elements['myText'];
   }
   alert(myText.value);
}
</SCRIPT>
</HEAD>
<BODY>
<DIV NAME="myDiv" CLASS="myStyle">
<FORM NAME="myForm">
<INPUT TYPE=TEXT NAME="myText">
<INPUT TYPE=BUTTON VALUE="Click here" ONCLICK="fnClick();">
</FORM>
</DIV>
</BODY>
</HTML>

Julian Skinner
Technical Editor
Wrox Press
http://www.wrox.com
julians@w...


-----Original Message-----
Subject: javascript for IE specific needed!!!
From: "Epyon" <chyekiang@c...>
Date: Tue, 13 Jun 2000 4:52:58
X-Message-Number: 1

hi, 

the code below works for Netscape, but not for IE

top.frames[5].document.layers["myA"].document.forms[plLine].ordrbox1.click()

basically wat it does is accessing a checkbox of a form found in a LAYER in 
a particular frame of an HTML page.

I have replace relevant IE specific standard as shown below, but it still 
throws me an error, saying "top.frames[5]..... .forms is not an object"

top.frames[5].document.all["myA"].forms[plLine].item("ordrbox1").click()

can anyone help? thanks!!!

  Return to Index