开发者

Javascript Buttons

开发者 https://www.devze.com 2022-12-16 01:47 出处:网络
Is it possible to set a button\'s onclick action to a javascript variable? The idea is that we are controlling a table with javascript. Whenever one clicks on a row of that table开发者_运维问答, we u

Is it possible to set a button's onclick action to a javascript variable? The idea is that we are controlling a table with javascript. Whenever one clicks on a row of that table开发者_运维问答, we update a javascript variable. That var would be the _GET var for the php script to be run.


Add this to the element you want to be clickable :

onclick="setAVariable()"

And then add this javascript function in a php file :

function setAVariable(){ 
    //dostuff 
    var get = "<?php echo _GET ?>" ;
}


myTr.onclick = function () {
    // Make sure you have a keyboard focusable and a non-JS alternative!
    document.forms.myform.elements.myhiddeninput.value = someValue;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消