Jump to content

[SOLVED] load sample data


raman

Recommended Posts

I have a form in which I have a textbox. I want that for a new use there should be a link on the form that would allow him to load or sample data to see a demonstration of how to use the form. This can be done using the onclick event.

can someone provide a script for this.This is the sample data,I will like to give.

>seq1

LLKKKKKKKKKKKK

>seq2

NLMMMMMMMMM

This is the part of the code.



<tr><td colspan=2>Enter or Paste a set of Sequences in any supported format<br>All sequences must be in the same format :</td></tr>
<tr>
<td colspan=2>
<textarea cols="75" rows="8" name="seq">
</textarea>
</td>
</tr>

 

Link to comment
https://forums.phpfreaks.com/topic/138376-solved-load-sample-data/
Share on other sites

Try using the 'alt' tag of the elements you want to have sample data for.

 

   <script type="text/javascript">

function loadSamples()
{
        for( var i = 0; i <= document.forms[ "blah" ].elements.length; i++ )
        {
		if( document.forms[ "blah" ].elements[ i ].alt )
        		document.forms[ "blah" ].elements[ i ].value = document.forms[ "blah" ].elements[ i ].alt;
        }
}

   </script>

<form name="blah">

<input type="text" alt="Sample1" />
    <input type="text" alt="Sample2" />
    <input type="button" onClick="loadSamples(); return false;" value="Load Samples" />

</form>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.