javascript to php |
javascript to php |
tudsy |
Sep 21 2017, 10:22 AM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
var a = document.getElementById('download');
a.href='http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe'; document.getElementById('dlink').innerHTML="http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe"; <a id= 'download' href="" onclick="callmail();"><p align='center' id='dlink'></p></a> Hi I was wondering. How do you write the above in php? Thanks. |
CharlesEF |
Sep 21 2017, 11:37 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
As far as I know, you can't. PHP knows nothing about HTML elements (at least not without some kind of add-in). PHP works with the HTML element values in <form>'s that are submitted.
|
Christian J |
Sep 21 2017, 03:13 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
a.href='http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe'; What's the point in calling an .exe file in the link URL? Compare http://htmlhelp.com/faq/html/all.html#run-program QUOTE document.getElementById('dlink').innerHTML="http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe"; innerHTML sets HTML or text, in the above example it would be URL as plain text --is that what you want? QUOTE I was wondering. How do you write the above in php? Do you mean you want PHP to output the above JS code? Or do you want PHP to run javascript? The latter doesn't work, though it is possible to run javascript on the server side with Node.js. |
tudsy |
Sep 21 2017, 10:23 PM
Post
#4
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
a.href='http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe'; What's the point in calling an .exe file in the link URL? Compare http://htmlhelp.com/faq/html/all.html#run-program QUOTE document.getElementById('dlink').innerHTML="http://103.226.223.161/~ecovibdc/ECOVIB2D/mysoftware/Cwp.exe"; innerHTML sets HTML or text, in the above example it would be URL as plain text --is that what you want? QUOTE I was wondering. How do you write the above in php? Do you mean you want PHP to output the above JS code? Or do you want PHP to run javascript? The latter doesn't work, though it is possible to run javascript on the server side with Node.js. Thanks for that. 1. I want people to download an exe file onto their computer. 2. Yes, I want php to out the above code. Thanks. |
Christian J |
Sep 22 2017, 05:39 AM
Post
#5
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
1. I want people to download an exe file onto their computer. Why not let PHP print an HTML link then? Why involve JS? QUOTE 2. Yes, I want php to out the above code. PHP can print JS code just like HTML. The above is not a working JS, though. Also I wouldn't print the static parts of HTML or JS with PHP, just data that's dynamically generated by the PHP script, from say a form submission or DB query. |
Lo-Fi Version | Time is now: 27th April 2024 - 09:54 PM |