Menu
Hello,
I’m using document.nodeName.innerHTML to change the content of a particular node. It is not working in my case. Can someone please let me know where I’ve went wrong. Please find the attached HTML file. Thanks in advance.
Thanks,
Apps
<i>
</i>document.getElementById('Aircraft').inn[COLOR="Red"][B]n[/B][/COLOR]erHTML="Remove from Favorite";
1. document.[formname].elementName.innerHTML = ???[/QUOTE]
Typo:
<i>
</i>document.getElementById('Aircraft').inn[COLOR="Red"][B]n[/B][/COLOR]erHTML="Remove from Favorite";
You have written an extra [B]n[/B] ?[/QUOTE]
I don't know why Mozilla and IE didn't fire any JS errors.[/QUOTE]
<i>
</i>[I]object[/I].[B][COLOR="Blue"]myCustomProperty[/COLOR][/B]="somevalue";
Because any JS interpreter will consider that as a simple assignment and [B]inn[B][COLOR="Red"]n[/COLOR] [/B]erHTML[/B] as a custom property. You have simply created a new property and give it a value.
It is perfect legal, isn't it? ?
[/QUOTE]
<i>
</i>[I]object[/I].[B][COLOR="Blue"]myCustomProperty[/COLOR][/B]="somevalue";
[CODE]function SimpleJSPortlet(id, window) {
this.id = id;
this.window = window;
}
SimpleJSPortlet.prototype.addListItem = function (value) {
var prefs = this.window.getAttribute("preferences");
prefs.setValue("Custom1", value);
this.window.setPortletPreferences(prefs, this.handleLoadPortletPreferences);
}
SimpleJSPortlet.prototype.handleLoadPortletPreferences =
function (portletWindow, status, portletPrefs) {
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
portletWindow.setAttribute("preferences", portletPrefs);
var prefs = portletPrefs.getMap();
var htmlStr = "Number of preferences: "+prefs.length + "<br/>";
for (var i=0; i<prefs.length; i++) {
temp = i + 1;
htmlStr += temp+" - "+prefs[i].name+" - "+prefs[i].values+" - "+prefs[i].readonly + "<br/>";
}
var temp = document.getElementById("show<%=portletWindowID%>");
temp.innerHTML = htmlStr;
}
else { alert("error loading feed"); }
}
<!-- when addListItem is called on simpleJSPortlet object I thought 'this' refers to javascript's 'window' object. But why is this referiing to SimpleJSPortlet function in addListItem method?--->
<form onsubmit="simpleJSPortlet.addListItem(this.newPref.value); return false;">
<input name="newPref" type="text"></input>
<input type="Submit" value="Add Pref"></input>
</form>[/CODE]
<i>
</i>onsubmit="[COLOR="Red"]s[/COLOR]impleJSPortlet.addListItem(this.newPref.value)
<i>
</i>onsubmit="SimpleJSPortlet.addListItem([COLOR="Blue"][B]this[/B][/COLOR].newPref.value)
Typo again:
<i>
</i>onsubmit="SimpleJSPortlet.addListItem([COLOR="Blue"][B]this[/B][/COLOR].newPref.value)
[B][COLOR="Blue"]this[/COLOR] [/B] refers the [B]form[/B] object (if this was your question)[/QUOTE]
<i>
</i>function myFunction() {
alert(this)
}
window.onload=myFunction;
<i>
</i><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>untitled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function myFunction() {
alert(this);
}
window.onload=function(){
myFunction();
var div=document.getElementById('myDiv');
div.onclick=myFunction;
}
</script>
</head>
<body>
<div id="myDiv">click me</div>
</body>
</html>
<i>
</i>function myConstructor(oName) {
this.name=oName;
}
var employee_1= new myConstructor('Joe Dowe');
var employee_2= new myConstructor('Ann Boyle');
alert(employee_1.name);
alert(employee_2.name);
Thanks a lot for providing such a detailed and useful information. This was indeed very useful. Once again thank you very much for explaining it in details.[/QUOTE]
0.1.9 — BETA 5.28