PINK HTML questions
Ron Czapala
Posts: 2,418
Does anyone know if there is a way to pass·querystring arguments (e.g.· test.htm?Nb_var01) to a PINK web page?
I get a page not found 404 error when I try test.htm?Nb_var01 but test.htm#Nb_var01 shows the page but document.location.search is empty.
I am trying to pass the name of a PINK variable to·a page.
I get a page not found 404 error when I try test.htm?Nb_var01 but test.htm#Nb_var01 shows the page but document.location.search is empty.
<html><head><title></title> </head><body> <script language="javascript"> if (document.location.search) { var querystring=document.location.search.split("&"); alert(document.location.search); // alert(querystring[noparse][[/noparse]0].substr(0)); document.write("Value: <" + querystring[noparse][[/noparse]0].substr(0) + ">"); } </script> </body></html>
I am trying to pass the name of a PINK variable to·a page.
Comments
hTotal = document.getElementById("htotalh").firstChild.nodeValue;
mTotal = document.getElementById("mtotalh").firstChild.nodeValue;
I am using this to pass values between pages, and between the host computer reading the PINK page and the DS1302 to set its time equal to the host computer.
Does this help?
Dave
·I really should have provided more info.
·I am trying to pass variable names (e.g. Nb_var00 ...)·to·resp.htm·in the querystring using a xmlHttpRequest when I click·various buttons (see attached jpg).
resp.htm code
Post Edited (ronczap) : 9/19/2009 12:28:23 PM GMT
Briefly, for what it may/not be worth:
I have a page with a dropdown selector that gets read on submission and sets values of the hidden inputs accordingly:
if (whichOne == 1) {document.dockForm.Nb_var21.value = date2;document.dockForm.Nb_var51.value = packdate2;}
At the bottom of the pages I have a listing of the vars:
<INPUT TYPE="hidden" NAME="Nb_var21" MAXLENGTH=12>
Then at the top of the code in the page, when it refreshes the first thing it does is read and act on the new variable data:
function totalTime() {
hTotal = document.getElementById("htotalh").firstChild.nodeValue;
mTotal = document.getElementById("mtotalh").firstChild.nodeValue;
if (hTotal == "NA") {
hTotal = 0;
}
if (mTotal == "NA") {
mTotal = 0;
}
document.getElementById("htotal").firstChild.nodeValue = hTotal;
document.getElementById("mtotal").firstChild.nodeValue = mTotal;
}
I have all of my data acquisition AND the code that acts on the data in the same page - I post it to itself. I write flags to Nb-var registers to tell the page what to do when it first loads each time... So the page may look different, and certainly contains the desired results (and/or directs the stamp to perform the selected actions), but it remains the same page.
That's about all I can offer...
Dave
· I have used the technique of hidden inputs and posting back to the same page before, but the xmlHttpRequest post/get method has some advantages but the PINK module isn't a full-fledged web server so I may have to try some otther approaches.
- Ron