473,399 Members | 3,106 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,399 software developers and data experts.

capturing innerHTML content through POST

34
Hi,
Is there easy way of capturing innerHTML content when the user submits the form? I tried using a hidden input field which works, however...is there any other way of doing this without using hidden input field?

Thanks,
Dave
Dec 6 '07 #1
6 2257
acoder
16,027 Expert Mod 8TB
The innerHTML of what?
Dec 6 '07 #2
gsherp
34
the innerHTML of a span element with text only, no form elements.
Dec 7 '07 #3
acoder
16,027 Expert Mod 8TB
So you want to post this innerHTML content to the server without using form elements?
Dec 7 '07 #4
I hope this helps:

[HTML]function sendData() {
var form = document.getElementById('myForm');
inputNode = document.createElement("input");
inputNode.type = "hidden";
inputNode.name = "hiddenKey";
inputNode.value = document.getElementById('key').innerHTML;
form.appendChild(inputNode);
document.myForm.submit();
}[/HTML]

and the HTML code:
[HTML]<form action="mypage" name="myForm" id="myForm" method="get">
<span id="key">some data</span>
<input type="button" onclick="sendData();return false;" value="submit" />
</form>[/HTML]
Dec 7 '07 #5
Also if you use XMLHttpRequest you later can remove all the hidden inputs from code.

Dan
Dec 7 '07 #6
gsherp
34
thanks,
I will try this.
Dec 7 '07 #7

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

Similar topics

4
by: JimMenees | last post by:
(code is at end of post) ------------------------------------------- I'm using an i-frame to grab a server-side text file and display its content elsewhere in the html document. On change of the...
15
by: Tony Gahlinger | last post by:
I'm using my browser (Mozilla/5.0 Linux i686 Gecko/20031007 Firebird/0.7) to do some client-side image processing. I want to capture the sequence of coordinates a user clicks on in xxx.jpg in the...
15
by: Larry Asher | last post by:
Hi all. I'm a bit of a novice in this arena so please forgive if this question reflects that. I am trying to grab the html from a website and display it within another webpage (once I get this to...
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
4
by: Steve Wolfie | last post by:
Hello all: Again, let me thank everyone who has helped in the past. Can't wait till I can help out with some advice of my own. Now, I am building an app that wishes to retrieve the output of...
16
by: Joel Byrd | last post by:
I am having this ridiculous problem of trying to set the innerHTML of a div node. It works in all other browsers, but internet explorer is giving me an "Unknown runtime error". This is actually...
7
by: garthusenet | last post by:
I have a fairly complicated application written in Javascript+DOM, and I've run into an odd problem that only shows up in Safari. Basically, after setting innerHTML of a DIV, the div ends up empty...
3
by: ilia | last post by:
Hi All, I am a newbie in terms of Javascript, I found some code on the net to swap rows in a table using innerHTML, this works fine in Firefox but IE is complaining, after some googling around I...
1
by: praveenmmohanan | last post by:
Hi..., We have a pretty huge form where the user/support spends more than 6 minutes. Now, behind the scenes, I wanted to capture the outerHTML data & send it to a different URL to save it in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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...

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.