473,507 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calling javascript within the value attribute of an html tag

69 New Member
Hi guys,

I wanted to set the value of a textbox to be the username of whoever is logged into my application.
In the login page, a session variable username was set to be the username of whoever successfully logged in.

On the form itself i have a text box called operators that would show this username but i am running into some trouble. A username is the persons name in common and Capital letters as follows eg. John Smith's username would be JohnSmith
However, In the textbox i want to see John Smith as the value
This is where my javascript opname() function comes in. It parses the username and adds a space.

what i have so far is as follows (So wrong)
Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="text" name="operators" id="operators" size="40" <? if (isset($_SESSION['username']))?>  value="return opname("<? $_SESSION['username'] ?> ");" />
  3.  
  4.  

The opname javascript code is working ,....I just dont know how to call it within the Value attribute
Can someone please help me
Dec 4 '07 #1
1 3585
drhowarddrfine
7,435 Recognized Expert Expert
You cannot do that because it assumes the browser is interpreting the html tags and attributes as anything but tags and attributes. The browser does not do this.
Dec 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

136
9201
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
13
6664
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
8
3623
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
2
5338
by: Debbie | last post by:
I have always used VBScript but now need to convert my syntax to JavaScript. In an external file, I have a function that is called when a user clicks a button on a login page. The function checks...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.