fee
-
Posts
7 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by fee
-
-
What I do is clear my table with (excluding the header):
while(table.rows.length>1) { table.deleteRow(1) }
and then I want to add some new rows with cells by:
var material = x.insertCell(0)var rodzaj = x.insertCell(1)var ilosc = x.insertCell(2)material.innerHTML = "jeden"rodzaj.innerHTML = "dwa"ilosc.innerHTML = "trzy"
I wonder if i can set class="someclassname" for new cells using DOM properties? Or is there other way/trick to do it?
-
if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=true; xmlDoc.load(url); getmessage() }
How can I check if all data have been loaded when xmlDoc is set to True?Is it possible for XML DOM httReqest to work asynchronously under Mozilla browsers?
-
Done it! I had to add:generate-xml.php (it's simplified for this post, actually data is taken from DB):<?phpprint ('<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n");print ('<list>' . "\n");...print ('</list>');?>
header("Content-Type: application/xml; charset=iso-8859-2");
before sending XML data...
-
I'm creating an XML data dynamically (PHP script) after selecting an option in HTML <select>. Next I want to parse this XML data in some way.I was trying to do it using only XML DOM but in that case I had to run PHP to generate XML file, save this file on a server and the load it by XML DOM function to make it all work.I want to ommit saving this file and pass data using httpXMLRequest - requesting PHP 'XML generating script' and getting XML date as an answer.It seems it doesn't work...I want to have this: http://www.w3schools.com/xml/tryit.asp?fil...httprequest_js4but changing:
<body onLoad="loadXMLDoc('cd_catalog.xml');">
to:
<body onLoad="loadXMLDoc('localhost/mag/generate-xml.php');">
generate-xml.php (it's simplified for this post, actually data is taken from DB):
<?phpprint ('<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n");print ('<list>' . "\n");print ('<listitem>' . "\n");print ('<id>1</id>' . "\n");print ('<text>jeden</text>' . "\n");print ('</listitem>' . "\n"); print ('<listitem>' . "\n");print ('<id>2</id>' . "\n");print ('<text>dwa</text>' . "\n");print ('</listitem>' . "\n"); print ('</list>');?>
Can I do it? Maybe there is other way to do it?
-
I want to change items of Select2 on change event of Select1.Select1's On Change event runs PHP script:
$result = mysql_query('SELECT id, name FROM mytable');print ('<?xml version="1.0" encoding="ISO-8859-1"?>');print ('<list>');while ($row = mysql_fetch_array($result)) { print ('<listitem>'); print ('<id>' . $row['id'] . '</id>'); print ('<text>' . $row['name'] . '</text>'); print ('</listitem>'); } print ('</list>');
I'm loading as it stays on w3schools (for Firefox):
var xmlFileUrlxmlFileUrl = 'script/generate-xml.php'//xmlFileUrl = 'localhost/test.xml'xmlDoc = document.implementation.createDocument("","",null)xmlDoc.load(xmlFileUrl)xmlDoc.onload=getmessage
And getmessage function is:
alert(xmlDoc.documentElement.nodeName)
It works fine when XML file is loaded from localhost, but when I try to get it from the gerator script I get this error message: Error: xmlDoc.documentElement has no propertiesIt looks like generated XML file is not even loaded into xmlDoc. Why is taht (it all works for IE both ways)? What should I do?
-
I was trying this:
if (document.getElementById('name').height > 23) {// do something}
but i got: 'setting a property that has only a getter' error message.How can I check it?
setting Class for cells inserted by insertCell() ?
in JavaScript
Posted