red_75116
asked on
Passing parameter from HTML to javascript function
I am trying to pass a html control value to a javascript function. My field is ifWOnumber, but when it opens the page the URL says
csserialization_printWO?nu mber=undef ined
function PrintThisPage(ord_no) {
var sOption = "toolbar=yes,location=no,d irectories =yes,menub ar=yes,";
var ord = document.getElementById("i fWOnumber" ).value;
sOption += "scrollbars=yes,width=750, height=600 ,left=100, top=25";
var winprint = window.open("CSSerializati on_PrintWO .aspx?numb er=" + ord, "Print", sOption);
winprint.focus();
}
What am I doing wrong?
csserialization_printWO?nu
function PrintThisPage(ord_no) {
var sOption = "toolbar=yes,location=no,d
var ord = document.getElementById("i
sOption += "scrollbars=yes,width=750,
var winprint = window.open("CSSerializati
winprint.focus();
}
What am I doing wrong?
ASKER
The pop up window opens, but this is the URL on the page
CSSerialization_PrintWO.as px?number= undefined
CSSerialization_PrintWO.as
If you view the page source what is the id of ifWOnumber - is it just ifWOnumber or some .net inspired ID
Use UniqueID to get the required value:
var ord = document.getElementById("< %= ifWOnumber.UniqueID %>").value;
Your control's container is introducing prefixes thus the need for UniqueID to identify the control. This solution only works for inline JS not if the method is declared in a JS file.
Where is PrintThisPage called/declared?Inline?
var ord = document.getElementById("<
Your control's container is introducing prefixes thus the need for UniqueID to identify the control. This solution only works for inline JS not if the method is declared in a JS file.
Where is PrintThisPage called/declared?Inline?
ASKER
Using a custom control called inputfield and the id is ifWOnumber
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var ord = document.getElementById("<