4点击按钮修改a标签的地址和热点文字

<input type="button" value="点击修改" id="btn4"/>
<a href="https://www.baidu.com/" id="a1"></a>
<script>
//根据id获取按钮,为按钮注册点击事件,添加事件处理函数
var btn4Obj=document.getElementById("btn4");
btn4Obj.onclick=function(){
var aObj=document.getElementById("a1")
aObj.innerText="我是修改后的内容";
aObj.href="https://www.cnblogs.com/zhangDY/p/11344502.html";
}
</script>

 

转载于:https://www.cnblogs.com/zhangDY/p/11423968.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
修改框架层的AlertDialog的确认和取消按钮的文字颜色,你可以尝试以下步骤: 1. 创建一个自定义的AlertDialog主题,在其中设置按钮的文字颜色。在你应用的 `res/values/styles.xml` 文件中添加以下代码: ```xml <style name="CustomAlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="android:buttonBarButtonStyle">@style/CustomButtonBarButtonStyle</item> </style> <style name="CustomButtonBarButtonStyle" parent="Widget.AppCompat.Button.ButtonBar.AlertDialog"> <item name="android:textColor">@color/custom_button_text_color</item> </style> ``` 2. 在你的 `res/values/colors.xml` 文件中定义你想要的自定义按钮文字颜色: ```xml <color name="custom_button_text_color">#FF0000</color> ``` 3. 在使用AlertDialog的地方,将主题设置为你自定义的主题。例如,在Activity中使用: ```java AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.CustomAlertDialogTheme)); builder.setTitle("Title") .setMessage("Message") .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // 点击确认按钮的逻辑 } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // 点击取消按钮的逻辑 } }); AlertDialog dialog = builder.create(); dialog.show(); ``` 通过以上步骤,你可以自定义AlertDialog的确认和取消按钮的文字颜色。记得将 `custom_button_text_color` 替换为你想要的颜色值。希望这能帮到你!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值