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
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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.