Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

client side scripts or server side - help!

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
I have a listbox dtc which looks up from a recordset.
I need to get the values from the listbox client side, so I set the scripting platform of the dtc to client side.

Then I have a client side script to get the values.
I get this error:
The Runat attribute of the Script tag or Object tag can only have the value 'Server'.

Here is the script. Can anyone tell me what I am doing wrong?

<script ID=&quot;clientEventHandlersJS&quot; LANGUAGE=&quot;javascript&quot; RUNAT=&quot;client&quot;>

function btnSubmit_onclick()
{
var varlocation;
varlocation=lstLocation.getText(lstLocation.selectedIndex);
document.write varlocation;
}

</script>

Thanks for any help.
 
You can take out the id and runat property from the script tag. By default, if the script's language=&quot;javascript&quot;, it will run client side in the users browser.

If you have the language=&quot;javascript&quot; in your <script> tag then the browser will recognize the following code as javascript. If your browser does not support javascript, then it will overlook this code.

I belive the runat property may be specific to language=&quot;vbscript&quot;.
 
Thanks, but now I get an
expected ;
error and the listbox doesn't show up at all!

What's going on!?
 
Check your syntax! If you are still using the code above, then line 3 of your function should be:

document.write(varLocation);

Javascript's write function requires the text to be within parenthesis. While vbScript response.write does not require ().
 
OK, no more expected ;, but still no more listbox.

Where is it?!
 
You question is unclear. It might be helpful to see more of your code.

varlocation=lstLocation.getText(lstLocation.selectedIndex);

What does this line of code do? What is lstLocation? Is this a form elemnt of type select? What is getText()? Is this another JavaScript function? Is this a function that you coded?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top