1
我期待這個代碼寫出如果我按下按鈕的次數是偶數還是奇數?相反沒有任何反應閃亮的動態按鈕按下錯誤
我的index.html
<html>
<head>
<script type="text/javascript" src="shared/jquery.js"></script>
<script type="text/javascript" src="shared/shiny.js"></script>
</head>
<body>
<input type="submit" name="submit" value="Press me!" class="button">
<p><div id="text" class="shiny-text-output" style="width: 150px; height: 25px; border: 1px solid black;"></div>
</body>
</html>
我server.R
shinyServer (function (input, output, session)
{
observe ({
x = input$button;
output$text = renderText ({
if (! is.null (x))
{
if (x %% 2 == 0) {
"You are even";
}
else {
"You are odd";
}
}
})
});
})
然後我不需要'class =「按鈕」';我呢? – gaitat
只有當你想要任何與按鈕類相關的CSS – jdharrison