L
lee.munheng
hi everyone,
basically, the page layout uses absolute positioning with some forms on
the left and an embedded object on the right. but, when i load the
page, i get the following error.
Error: document.inputform has no properties ... Line: 10
i've tried using
window.document.inputform.externalID.readonly="readonly";
and even
document.forms['inputform'].elements['externalID'].readonly="readonly";
please help.
mh
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
window.onload = function() {
document.inputform.externalID.readonly="readonly";
}
function doGreyout(value) {
switch(value) {
case "switch":
alert("switch");
break;
case "node":
alert("node");
break;
case "edge":
alert("edge");
document.inputform.externalID.readonly="readonly";
break;
default:
alert("no such option!");
}
}
function doNewInterface() {
}
</script>
</head>
<body>
<div id="sidebar1" style="position: absolute; top: 50px; left:
10px; width: 200px; height: 100%; border: 1px dashed blue; padding:
5px;">
<form name="nodetypeform">
<select name="nodeTypes"
onchange="doGreyout(this.options[this.selectedIndex].value);">
<option value="node">Node</option>
<option value="switch">Switch</option>
<option value="edge">Edge</option>
</select>
</form>
<form name="inputform">
<p>Name<br />
<input type="text" name="nodename" size="18"
maxlength="80"></input>
</p>
<p>External ID<br />
<input type="text" name="externalID" size="18"
maxlength="80"></input>
</p>
<p>Internal ID<br />
<input type="text" name="internalID" size="18"
maxlength="80"></input>
</p>
<p>Interfaces
<input type="button" value="Add"
onclick="doNewInterface"></input>
</p>
<p>
<input type="button" value="Create node"
onclick="window.doNewButton(this)">
</input>
</p>
</form>
</div>
<div id="sidebar2" style="position: absolute; top: 500px; left:
10px; width: 200px; height: 200px; border: 1px dashed blue">
</div>
<div id="SVGCanvas" style="position: absolute; top: 50px; left:
240px; width: 600px; height: 600px; border: 1px dashed blue">
<embed src="canvas.svg" width="600" height="600"
type="image/svg+xml"></embed>
<noembed>SVG Canvas</noembed>
</div>
</body>
</html>
basically, the page layout uses absolute positioning with some forms on
the left and an embedded object on the right. but, when i load the
page, i get the following error.
Error: document.inputform has no properties ... Line: 10
i've tried using
window.document.inputform.externalID.readonly="readonly";
and even
document.forms['inputform'].elements['externalID'].readonly="readonly";
please help.
mh
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
window.onload = function() {
document.inputform.externalID.readonly="readonly";
}
function doGreyout(value) {
switch(value) {
case "switch":
alert("switch");
break;
case "node":
alert("node");
break;
case "edge":
alert("edge");
document.inputform.externalID.readonly="readonly";
break;
default:
alert("no such option!");
}
}
function doNewInterface() {
}
</script>
</head>
<body>
<div id="sidebar1" style="position: absolute; top: 50px; left:
10px; width: 200px; height: 100%; border: 1px dashed blue; padding:
5px;">
<form name="nodetypeform">
<select name="nodeTypes"
onchange="doGreyout(this.options[this.selectedIndex].value);">
<option value="node">Node</option>
<option value="switch">Switch</option>
<option value="edge">Edge</option>
</select>
</form>
<form name="inputform">
<p>Name<br />
<input type="text" name="nodename" size="18"
maxlength="80"></input>
</p>
<p>External ID<br />
<input type="text" name="externalID" size="18"
maxlength="80"></input>
</p>
<p>Internal ID<br />
<input type="text" name="internalID" size="18"
maxlength="80"></input>
</p>
<p>Interfaces
<input type="button" value="Add"
onclick="doNewInterface"></input>
</p>
<p>
<input type="button" value="Create node"
onclick="window.doNewButton(this)">
</input>
</p>
</form>
</div>
<div id="sidebar2" style="position: absolute; top: 500px; left:
10px; width: 200px; height: 200px; border: 1px dashed blue">
</div>
<div id="SVGCanvas" style="position: absolute; top: 50px; left:
240px; width: 600px; height: 600px; border: 1px dashed blue">
<embed src="canvas.svg" width="600" height="600"
type="image/svg+xml"></embed>
<noembed>SVG Canvas</noembed>
</div>
</body>
</html>