473,663 Members | 2,705 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 3594
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
9307
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
13
6687
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 getting as far as the iframe section as other parts of the html code work correctly. But it is not executing any code within the getPage() function as some "hello world" writes within getPage() wouldn't print. ...
8
3657
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
2
5354
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 the format of data that has been entered by the user and makes sure that all required fields have been filled out. On the login page, between the <head></headtags I have the following syntax: <script language="javascript"...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.