在不同页面上创建调用按钮单击事件的HTML链接

在不同页面上创建调用按钮单击事件的HTML链接,html,css,Html,Css,根据下面的代码,我能够创建一个带有参数的链接,这些参数将导航到我想要的目标页面: <style> .fancy-link{ color: #FFFFFF; text-decoration: none; transition: all 0.3s linear; -webkit-transition: all 0.3s linear; -moz-transition: all 0.3s

根据下面的代码,我能够创建一个带有参数的链接,这些参数将导航到我想要的目标页面:

<style>
    .fancy-link{
        color: #FFFFFF;  
        text-decoration: none;  
        transition: all 0.3s linear;  
        -webkit-transition: all 0.3s linear;  
        -moz-transition: all 0.3s linear;
        border-radius: 4px; 
        border: 1px solid black; 
        background: #0080FF;  
        padding-top: 0px;  
        padding-left: 5px; 
        padding-right: 5px; 
        padding-bottom: 0px; 
        width: 100px;  
        height: 10px; 
        font-size: 15px; 
        font-weight: bold;} 

  .fancy-link:hover{ 
        color: #F44336;   
        padding-left: 10px;}
</style>

<html>
<a class="fancy-link" name="View" id="View"
  href="'||'https://XXXXXX-sb1.app.website.com/app/common/custom/custrecordentry.nl?
  rectype=142&id='||{internalid}||'"target="_blank">Check-In</a>
</html>

.花式链接{
颜色:#FFFFFF;
文字装饰:无;
过渡:所有0.3s线性;
-webkit转换:所有0.3s线性;
-moz过渡:所有0.3s线性;
边界半径:4px;
边框:1px纯黑;
背景:#0080FF;
填充顶部:0px;
左侧填充:5px;
右侧填充:5px;
垫底:0px;
宽度:100px;
高度:10px;
字体大小:15px;
字体大小:粗体;}
.花式链接:悬停{
颜色:#F44336;
左填充:10px;}
虽然这很有用,但我的目标是让此链接实际调用以下按钮,单击位于所需url处@的事件/元素(请参见上面的href),而不实际导航到该页面。这可能吗?如果是这样,一些代码示例将非常有用

 .<input type="button" style="" class="rndbuttoninpt bntBgT"value="Check-In" id="custpageworkflow157" name="custpageworkflow157"onclick="try{
    if (!!window) {
        var origScriptIdForLogging = window.NLScriptIdForLogging;
        var origDeploymentIdForLogging = window.NLDeploymentIdForLogging;
        window.NLScriptIdForLogging ='CUSTOMSCRIPT_STICK_USER_PREFERENCE';
        window.NLDeploymentIdForLogging= 'CUSTOMDEPLOY_STICK_USER_PREFERENCE';
    }
    try{
        NS.Workflow.buttonClick('custpageworkflow157');
    }
    catch(e){
        document.location = addParamToURL(addParamToURL(addParamToURL(document.location.href,'workflowbutton','157'),'workflowbuttoninstanceid','84083'),'workflowbuttonobsoletehandling','T');
    }
}
finally{
    if (!!window) {
        window.NLScriptIdForLogging = origScriptIdForLogging;
        window.NLDeploymentIdForLogging = origDeploymentIdForLogging;
    }
}
;
return false;
"onmousedown="this.setAttribute('_mousedown','T');
setButtonDown(true, false, this);
" onmouseup="this.setAttribute('_mousedown','F');
setButtonDown(false, false, this);
" onmouseout="if(this.getAttribute('_mousedown')=='T') setButtonDown(false,false, this);
" onmouseover="if(this.getAttribute('_mousedown')=='T') setButtonDown(true, false, this);
" _mousedown="F">

您应该可以通过创建按钮中的简单事件侦听器来解决此问题:

document.getElementById('custpageworkflow157).click();
基本上是这样的:

document.getElementById("View").addEventListener("click", function(){
    document.getElementById('custpageworkflow157).click();
});

所以你想点击另一个页面上的一个按钮而不导航到它,我不知道这是否可能,但我能问一下为什么这种方法?你不能直接从第一页提交请求到你想在第二页提交的操作吗?嗨,Edu。不,这是不可能的,因为这是一个结果列公式,正在注入代码(hack)——为每一行创建一个链接/按钮;它需要与字符串文本内联。这是内联注入,所以它需要是字符串文本,这会让人困惑;但是,它似乎忽略了脚本代码;我可以在脚本标记内执行alert(),而不会出现问题:
'document.getElementById(“视图”).addEventListener(“单击”,function(){document.getElementById(“custpageworkflow157”)。click();“
我缺少什么?