netscape is such a headache...
it seems that there is nothing built into the dynapi to handle form elements
within layers... so you'll have to roll your own goodness... first thing,
wrap your form html with div tags to create the inline layer... next, name
your form elements with the name property... lastly, DoOnChangeLang must
have some logic to look at the layer's document instead of the default
document...
the following code should produce the effect you desire (works on NS4.74 &
IE5.0)
<html>
<head>
<title>Select example</title>
<script language="Javascript" src="/javascript/dynapi.js"></script>
<script language="Javascript1.1">
DynAPI.setLibraryPath('/SrcDC/_Gen/')
DynAPI.include('dynacore.api.*')
DynAPI.include('dynacore.ext.inline')
DynAPI.onLoad=function() {
// do nothing
return;
}
</script>
<script language="Javascript">
function DoOnChangeLang(){
var layerDocument = document;
if ( is.ns ) {
layerDocument = document.layers["main"].document;
}
selectBox = layerDocument.frmMain.selLang;
optionNumber = selectBox.selectedIndex;
alert ( "Select Box Name: " + selectBox.name );
alert ( "Selected Option: " +
selectBox.options[optionNumber].value );
}
</script>
</head>
<body>
<div id="main" STYLE="position: absolute">
<form name="frmMain">
<p>Language:
<select name="selLang" onchange="DoOnChangeLang()">
<option value="Gr">Greek
<option value="En">English
</select>
</p>
</form>
</div>
</body>
</html>
-Grant
-----Original Message-----
From: GORTSILAS ANDREAS [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 24, 2001 6:26 AM
To: Dynapi-Help Mailing List (E-mail); [EMAIL PROTECTED] (E-mail)
Subject: [Dynapi-Help] Get element other than div...
In the following page I want to handle the selected value of the select
element:
<html>
<head>
<title>Select example</title>
<script language="Javascript1.1" src="/SrcDC/_Gen/dynapi.js"></script>
<script language="Javascript1.1">
DynAPI.setLibraryPath('/SrcDC/_Gen/')
DynAPI.include('dynacore.api.*')
DynAPI.include('dynacore.ext.inline')
DynAPI.onLoad=function() {
}
</script>
<script language="Javascript">
function DoOnChangeLang(){
alert(DynAPI.document.elements["selLang"]); // undefined!!
alert(DynAPI.document.getElementById('selLang').options.item(0).value); //
undefined!!
// alert(document.all['selLang'].options.item(0).value); // works only
in IE
// alert(frmMain.selLang.options.item(0).value); } // works only
in IE
</script>
</head>
<body>
<form id="frmMain">
<p>Language:<select id="selLang" onchange="DoOnChangeLang()"><option
value="Gr">Greek<option value="En">English</select></p>
</form>
</body>
</html>
How I can do this? Do you have any idea?
What is your approach to similar tasks?
Thanks
Andreas
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help