473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Passing text from JavaScript function to XHTML

55
I am trying to a pass "text sentence" from a JavaScript function into my XHTML program is this possible??

JavaScript function validate.pdf

Please see attached attached JavaScript coding.

The reason why I am trying to pass text from JavaScript to my XHTML program is, because depending on whether or not a certain input field is filled out or not I want certain text to be displayed within my XHTML page...

Regards
Gary Wilson
Apr 25 '10 #1
5 1901
RamananKalirajan
608 512MB
Yes you can do that. Either you can alert the text to show the user that this field is missing. Otherwise have a div in the HTML and print the text in that div

sample Code
HTML:
Expand|Select|Wrap|Line Numbers
  1. <div id="errorMsg">
  2. </div>
Js
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('errorMsg').innerHTML=alerttext;
Thanks and Regards
Ramanan Kalirajan
Apr 25 '10 #2
neogazz
55
@RamananKalirajan
Thanks Ramanan, for the info.

In my situation I would prefer not to use 'alerttext' popup and rather display the text directly in a area (but not a text area) within the XHTML document.

I like the div method though. Where do you place the function "document.getElementById('errorMsg').innerHTML=ale rttext;", would this be inside my function "validate_required"??

Thanks and regards
Gary Wilson
Apr 25 '10 #3
RamananKalirajan
608 512MB
Yes you have to include that line in the validate_required method. Where the condition fails.

Thanks and Regards
Ramanan Kalirajan
Apr 25 '10 #4
neogazz
55
@RamananKalirajan
Thanks, I have tested this and it works well :)
Apr 25 '10 #5
RamananKalirajan
608 512MB
Good. Keep Moving forward. Post back if you have any doubts.

Thanks and Regards
Ramanan Kalirajan
Apr 25 '10 #6

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

Similar topics

6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
4
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html...
1
by: Greg | last post by:
This renders in Firefox perfectly well but the text in the red box remains invisible. The program is a subset of a larger and doesn't do much. but even after cutting out all the unneccessary stuf,...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
1
by: emailseshu | last post by:
Hi, Iam trying to check the Client Side CallBack Feature in ASP.NET Iam able to call th RaiseCallbackEvent from the Client Side Javascript Function but when I go to the debug mode to check the...
5
by: moni | last post by:
Hi.. I am trying to use javascript for google maps display. If I call the javascript function from my aspx file I use: <input type="text" id="addresstext" value="Huntington Avenue,...
1
by: mmalloc | last post by:
I have the following code to move some text with javascript that works both on ie and ff. I can't make it XHTML compatble. If i remove the doctype info it will work. I'm sorry to bother with such...
5
by: TurboRogue | last post by:
So here's the basic premise: I have an html page with a bunch of pictures (pic.html). All of the images are thumbnails of larger photos. I also have another html page which is a pop-up window...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
9
by: Steve | last post by:
Hi; I've being going through some legacy code on an old JSP site I have been patching. I noticed that when I save the JSP down to my PC as an HTML file I get this javascript error in IE 6 ( ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.