473,322 Members | 1,671 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,322 software developers and data experts.

Inline JS Function Help

TC

IE only (V6).

First, I know very little JS and our resident expert is short on time,
so I come to you for help. I have a dynamic CGI script (written in
Progress) that generates the following HTML:

<input type="hidden" name="NoteText" id="NoteText" value="Test">

<a onclick="NoteText=prompt('Enter Note'); alert(NoteText);"
class=MENU href="priority-mail-cgi?Context-ID=cakvfDljlSpYCVac"
target=priority_mail>Penalty Related Mail Received</a>

Here's what I'm trying to accomplish:

1) User clicks Penalty Related Mail link.
2) A JS function displays and accepts user-entered text.
3) Take the text the user just entered and place it in the hidden field
"NoteText" so that I can read it by another CGI program.

In the code above, I added the alert() function as a test. It is not
being displayed so I believe the code is stopping at the prompt()
function.

I have to use inline functions because I'm working with an include file
that generates this small part of the HTML code. At this point there is
no way around it.

Any help is greatly appreciated!
--

Jan 29 '07 #1
2 2155
TC wrote:
IE only (V6).
<input type="hidden" name="NoteText" id="NoteText" value="Test">

<a onclick="NoteText=prompt('Enter Note'); alert(NoteText);"
class=MENU href="priority-mail-cgi?Context-ID=cakvfDljlSpYCVac"
target=priority_mail>Penalty Related Mail Received</a>
Make that
<a onclick="var NoteText = prompt('Enter Note', ''); if (NoteText !=
null) { document.getElementById('NoteText').value = NoteText; }"
that way your script should set the input type="hidden". On the other
hand you have a href attribute on the link so once the onclick has been
executed the browser will follow that link and does not submit the form
with the hidden input. It is not clear what you want to achieve, it
might be that an input type="submit" button instead of the link will do
what you want.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 29 '07 #2
TC
Martin Honnen wrote:
TC wrote:
IE only (V6).
<input type="hidden" name="NoteText" id="NoteText" value="Test">

<a onclick="NoteText=prompt('Enter Note'); alert(NoteText);"
class=MENU href="priority-mail-cgi?Context-ID=cakvfDljlSpYCVac"
target=priority_mail>Penalty Related Mail Received</a>

Make that
<a onclick="var NoteText = prompt('Enter Note', ''); if (NoteText !=
null) { document.getElementById('NoteText').value = NoteText; }" that
way your script should set the input type="hidden". On the other hand
you have a href attribute on the link so once the onclick has been
executed the browser will follow that link and does not submit the
form with the hidden input. It is not clear what you want to achieve,
it might be that an input type="submit" button instead of the link
will do what you want.
Hmmm. Now the prompt() function doesn't even display. I still want to
follow the link, just after the user enters information in the prompt.

--

Jan 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Abhi | last post by:
Hi, - Are there any cardinal rules as to when a function should not be inlined? - If a function, say f, is being called from multiple other functions/classes, should that function f, be always...
14
by: Chris Mantoulidis | last post by:
I am not clear with the use of the keyword inline... I believe you add it do a function when you implement the function inside the header file where the class is stored... But is that all? What...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
21
by: Rubén Campos | last post by:
I haven't found any previous message related to what I'm going to ask here, but accept my anticipated excuses if I'm wrong. I want to ask about the real usefulness of the 'inline' keyword. I've...
20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
4
by: Nish | last post by:
Hi, I have a question regarding inline functions in C. If I declare a function as inline in the header file but do not define it there. Then I define that function in .c file, however neither...
4
by: mashrur.mia | last post by:
Hello All, Since "inline" keyboard is basically an advice to the compiler to inline a function, is there a way to know whether the complier took the advice? I guess one way to verify is to...
25
by: toton | last post by:
Hi, As inline is not mandetory, it depends on compiler to inline certain function (or using switch like fior GCC), my question is there any scope for inlining when it is not declared as inline...
3
by: shuisheng | last post by:
Dear All, If I define a virtual function to be inline, is it really inline? Or it is inline in some cases, and not in other cases. Would you please help me to look at the following case. ...
6
by: Laurent Deniau | last post by:
When I compile the code below with gcc -std=c99 -W -Wall -pedantic -O3 -Winline, it reports the following: variadic.c: In function ‘fv’: variadic.c:12: warning: function ‘fv’ can never be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.