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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to apply javascript to stylesheets? 1

Status
Not open for further replies.

debrac

IS-IT--Management
Jan 9, 2001
48
0
0
AU
is there a way to apply a line of javascript to CSS style sheet class? ie. i want to put this line of code: onFocus="this.select();"
to all input text boxes.
thanks.
 
You can not ackomplish this with CSS. You could easily do this in a server-side environment like JSP or ASP. You would simply create a variable and set that variable's value = to the javascript command you want to execute. You could then place that variable inside each of the form elements that require this script. Otherwise, if you are in a static environment, ie HTML, you are left with placing the javascript function in each form element.
 
did this thread answer your question?

thread216-224055
***
debrac (IS/IT--Manageme) Mar 5, 2002
how do i highlight the whole text in text box when using the mouse to enter the text box at any point of the text?
thanks

--reply--

ICantLogin (Visitor) Mar 5, 2002

<html>
<head>
</head>
<body>
<input type=text value=&quot;12345678&quot; onclick=&quot;this.select();&quot;>
</body>
</html>
***

if not, please re-explain your intent...


- spewn
 
This is possible with javascript, which you must know. You can use the DOM to get your INPUT tags or any other tags for that matter, but you need to know how to loop through them and set their onfocus property to your code.

My javascript editor is not installed right now, otherwise I would give you a hint on the code. Rocco is the BOY!!

M O T I V A T E!
ROCCOsm.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top