Pulling screen resolution with easy JavaScript Document Write. Using ColdFusion 9.0.
I can get proper numbers etc. But they are not "numbers" must be coming as text. As I cannot use as a number variable...
The code gets me: Available browser width: 1366 Available browser height: 728
And error of: The value document.write(screen.availWidth); cannot be converted to a number.
Any ideas of how to simply convert these to numbers I can work with... Without putting into a form and resubmitting through a form???
Thx
<cfset screenwidth = "<script>document.write(screen.width);</script>" >
<cfset screenheight = "<script>document.write(screen.height);</script>" >
<cfset availWidth = "<script>document.write(screen.availWidth);</script>" >
<cfset availHeight = "<script>document.write(screen.availHeight);</script>">
<cfoutput>
<div style="padding:15px;">
Available browser width: #availWidth#<br />
Available browser height: #availHeight#<br />
</div>
</cfoutput>
<cfset nw = availWidth * 2>
<cfset nh = availheight * 2>
<cfoutput>#nw# and #nh#</cfoutput>
Aucun commentaire:
Enregistrer un commentaire