...

View Full Version : anyone can modify this script?



xiaodao
12-25-2004, 10:31 AM
anyone can modify the following script no to show in the text field but in a table


//get scripts from javascriptkit.com
<center>
<form name="combowithtext">
<select name="example" size="1" onChange="showtext()">
<option value="http://www.cnet.com">Cnet</option>
<option value="http://www.cnn.com">CNN</option>
<option value="http://www.geocities.com">Geocities</option>
</select>
<input type="button" value="Go!"
onClick="gothere()"><br>
<textarea rows=5 cols=21 wrap="virtual" name="text"></textarea>
<script language="javascript">
<!--

var shortcut=document.combowithtext
var descriptions=new Array()

//extend this list if neccessary to accomodate more selections
descriptions[0]="Click here for Cnet, the primer technology site on the net!"
descriptions[1]="Click here for CNN, one of the best sources online to get your news."
descriptions[2]="Click here for Geocities, and receive 10 megs of free web space."


shortcut.text.value=descriptions[shortcut.example.selectedIndex]
function gothere(){
location=shortcut.example.options[shortcut.example.selectedIndex].value
}

function showtext(){
shortcut.text.value=descriptions[shortcut.example.selectedIndex]
}
//-->
</script>

</form>
</center>

Willy Duitt
12-27-2004, 03:33 AM
Create your table and give an ID to the data cell you wish to enter the chosen text... and then change this line:

shortcut.text.value=descriptions[shortcut.....

To point to the data cell using:

document.getElementById('ID_OF_DATA_CELL').innerHTML = descriptions[shortcut.....

.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum