Believe me I've been doing plenty of that, but I also have been finding trial and error to be very instructive too. I did take a look at your divs.js file. I don't yet understand all of it. I tried your divFind and divWrite functions and I'm pretty sure I'm understanding what they do. Unfortunately the divWrite doesn't do what I want. I want to put a Jmol applet into the div and this function appears to only write text into a div. I tried divWrite(jmolID, newJmol) and divWrite(jmolID, eval(newJmol) where jmolID is a variable that holds the div's id and newJmol is a Jmol applet object. Unfortunately both off these do the same thing which is to write the function used to create the Jmol applet object into the into the div as text.

I've also tried the following code:

document.getElementById(jmolID).appendChild(newJmol);

which produces the following error message in FireBug:
        
uncaught exception: Node cannot be inserted at the specified point in the hierarchy (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)


document.getElementById(jmolID).update(newJmol);

gives the error: document.getElementById(jmolID).update is not a function


I've tried several variations. I got it to work once using: newDiv.update(jmolApplet(400, eval(_jmolApplet.loadString))); where newDiv was a reference to a div element, but this only worked in Safari and not Firefox.

Unfortunately, everywhere I've read about adding something to a div element the something being added is text. I can't find anywhere that gives an example off adding some other kind of object.

Perhaps I should give it up. I thought it would be possible to create a Jmol applet object and add it to the web page. Then I would be able to include methods in the Jmol applet object constructor to change jmol parameters and such. Obviously there are other ways to do that, but this just seems an attractive way to me for some reason.


***********************************************
Jeff Hansen
Department of Chemistry and Biochemistry
DePauw University
602 S. College Ave.
Greencastle, IN 46135
[EMAIL PROTECTED]
***********************************************


On Aug 27, 2008, at 2:14 PM, Robert Hanson wrote:

>> I'm working towards my own at this point and I'm afraid looking at yours will just prevent my learning how to do it myself.

Shame! NEVER say that! The way to learn this is by adapting anything you can find. That's the great thing about JavaScript. Learn how these code fragments work by testing it in your own application. You will learn lots.

Bob

--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to