472,984 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

calling javascript within the value attribute of an html tag

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
  2. <input type="text" name="operators" id="operators" size="40" <? if (isset($_SESSION['username']))?>  value="return opname("<? $_SESSION['username'] ?> ");" />

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 3562
7,435 Expert 4TB
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

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...
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...
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
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...
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.