Howdy All,

 

I’m trying to make a button that will successively highlight different residues on the protein.  It will initially highlight, say, residue 10 but when clicked again will highlight residue 11, and then 12 and so on.

 

I think the way to go is to have some global variable ‘resnum’ which gets incremented every time the button is pressed.  Then this resnum variable would be included in the script that is executed, to indictate which residues need to be highlighted. 

 

I implemented this as follows below.  However, the button does not change anything after repeated clicks.  In fact, I can’t get it to do anything differently by modifying the ‘script’ variable inside the onClick event.  Is it possible to do things this way?  I’m trying to avoid the strategy reloading the whole web page with new parameters..

 

Any advice on how to do this?

 

Many thanks,  

 

Sam

 

function jmolButton_hinge(script, label, id) {

  _jmolInitCheck();

  var scriptIndex = _jmolAddScript(script);

  if (label == undefined || label == null)

    label = script.substring(0, 32);

  if (id == undefined || id == null)

    id = "jmolButton" + _jmol.buttonCount;

  ++_jmol.buttonCount;

  var t = "<input type='button' name='" + id + "' id='" + id +

          "' value='" + label +

          "' text-autospace:none'>          ")   ;script = \"  select *; color green; spacefill 2.0;\"  ;  scriptIndex=_jmolAddScript(script);  _jmolClick(" + scriptIndex + _jmol.targetText +")   '   text-autospace:none'> 

          ");return true' " +

          _jmol.buttonCssText + "/>";

  if (_jmol.debugAlert)

    alert(t);

  document.write(t);

}

 

 

Samuel Flores

Graduate Student

Gerstein Lab

Bass 437

Office: 203.432.5405

Home: 203.752.2068

 

Reply via email to